pike.git / src / modules / Gz / zlibmod.c

version» Context lines:

pike.git/src/modules/Gz/zlibmod.c:138:       if(THIS->gz.state)    {   /* mt_lock(& THIS->lock); */    deflateEnd(&THIS->gz);   /* mt_unlock(& THIS->lock); */    }       if(args>2)    { -  if(sp[2-args].type != T_INT) +  if(TYPEOF(sp[2-args]) != T_INT)    Pike_error("Bad argument 3 to gz->create()\n");    wbits = sp[2-args].u.integer;    if( wbits == 0 ) wbits = 15;    if( wbits < 8 || wbits > 15 )    Pike_error("Invalid window size for gz_deflate->create().\n");    }       if(args)    { -  if(sp[-args].type != T_INT) +  if(TYPEOF(sp[-args]) != T_INT)    Pike_error("Bad argument 1 to gz->create()\n");    THIS->level=sp[-args].u.integer;    if( THIS->level < 0 )    {    wbits = -wbits;    THIS->level = -THIS->level;    }    if(THIS->level < Z_NO_COMPRESSION ||    THIS->level > Z_BEST_COMPRESSION)    {    Pike_error("Compression level out of range for gz_deflate->create()\n");    }    }       if(args>1)    { -  if(sp[1-args].type != T_INT) +  if(TYPEOF(sp[1-args]) != T_INT)    Pike_error("Bad argument 2 to gz->create()\n");    strategy=sp[1-args].u.integer;    if(strategy != Z_DEFAULT_STRATEGY &&    strategy != Z_FILTERED &&   #ifdef Z_RLE    strategy != Z_RLE &&   #endif   #ifdef Z_FIXED    strategy != Z_FIXED &&   #endif
pike.git/src/modules/Gz/zlibmod.c:481:    deflateInit(& THIS->gz, THIS->level);    THIS->state=0;    }       if(!THIS->gz.state)    Pike_error("gz_deflate not initialized or destructed\n");       if(args<1)    Pike_error("Too few arguments to gz_deflate->deflate()\n");    -  if(sp[-args].type != T_STRING) +  if(TYPEOF(sp[-args]) != T_STRING)    Pike_error("Bad argument 1 to gz_deflate->deflate()\n");       data=sp[-args].u.string;    if (data->size_shift)    Pike_error("Cannot input wide string to gz_deflate->deflate()\n");       if(args>1)    { -  if(sp[1-args].type != T_INT) +  if(TYPEOF(sp[1-args]) != T_INT)    Pike_error("Bad argument 2 to gz_deflate->deflate()\n");       flush=sp[1-args].u.integer;       switch(flush)    {    case Z_PARTIAL_FLUSH:    case Z_FINISH:    case Z_SYNC_FLUSH:    case Z_NO_FLUSH:
pike.git/src/modules/Gz/zlibmod.c:612:    {   /* mt_lock(& THIS->lock); */    inflateEnd(&THIS->gz);   /* mt_unlock(& THIS->lock); */    }          THIS->gz.zalloc=Z_NULL;    THIS->gz.zfree=Z_NULL;    THIS->gz.opaque=(void *)THIS; -  if( args && Pike_sp[-1].type == PIKE_T_INT ) +  if( args && TYPEOF(Pike_sp[-1]) == PIKE_T_INT )    {    tmp=inflateInit2(& THIS->gz, Pike_sp[-1].u.integer);    }    else    {    tmp=inflateInit( &THIS->gz );    }    pop_n_elems(args);      /* mt_lock(& THIS->lock); */
pike.git/src/modules/Gz/zlibmod.c:781:    *! defined in RFC 1950.    */   static void gz_uncompress(INT32 args)   {    dynamic_buffer buf;    ONERROR err;    int raw = 0;       if(args<1)    SIMPLE_TOO_FEW_ARGS_ERROR("uncompress", 1); -  if(Pike_sp[-args].type!=PIKE_T_STRING) +  if(TYPEOF(Pike_sp[-args]) != PIKE_T_STRING)    SIMPLE_BAD_ARG_ERROR("uncompress", 1, "string");    if (Pike_sp[-args].u.string->size_shift)    Pike_error("Cannot input wide string to uncompress\n");    if(args>1)    { -  if(Pike_sp[1-args].type==PIKE_T_INT) +  if(TYPEOF(Pike_sp[1-args]) == PIKE_T_INT)    raw = Pike_sp[1-args].u.integer;    else    SIMPLE_BAD_ARG_ERROR("uncompress", 2, "int");    }       initialize_buf(&buf);    SET_ONERROR(err, toss_buffer, &buf);    zlibmod_unpack(Pike_sp[-args].u.string, &buf, raw);    UNSET_ONERROR(err);   
pike.git/src/modules/Gz/zlibmod.c:837:    struct zipper *this=THIS;    dynamic_buffer buf;    ONERROR err;       if(!THIS->gz.state)    Pike_error("gz_inflate not initialized or destructed\n");       if(args<1)    Pike_error("Too few arguments to gz_inflate->inflate()\n");    -  if(sp[-args].type != T_STRING) +  if(TYPEOF(sp[-args]) != T_STRING)    Pike_error("Bad argument 1 to gz_inflate->inflate()\n");       data=sp[-args].u.string;    if (data->size_shift)    Pike_error("Cannot input wide string to gz_inflate->inflate()\n");       this->gz.next_in=(Bytef *)data->str;    this->gz.avail_in = DO_NOT_WARN((unsigned INT32)(data->len));       initialize_buf(&buf);
pike.git/src/modules/Gz/zlibmod.c:877:    {    struct pike_string *old_epilogue = this->epilogue;    if(old_epilogue) {    push_string(old_epilogue);    this->epilogue = NULL;    }    push_string(make_shared_binary_string((const char *)this->gz.next_in,    this->gz.avail_in));    if(old_epilogue)    f_add(2); -  if(sp[-1].type == PIKE_T_STRING) +  if(TYPEOF(sp[-1]) == PIKE_T_STRING)    this->epilogue = (--sp)->u.string;    else    pop_stack();    }       if(fail != Z_STREAM_END && fail!=Z_OK && !sp[-1].u.string->len)    {    pop_stack();    push_int(0);    }
pike.git/src/modules/Gz/zlibmod.c:942:   /*! @decl int crc32(string data, void|int start_value)    *!    *! This function calculates the standard ISO3309 Cyclic Redundancy Check.    *!    *! @note    *! Data must not be wide string.    */   static void gz_crc32(INT32 args)   {    unsigned INT32 crc; -  if (!args || -  sp[-args].type!=T_STRING) +  if (!args || TYPEOF(sp[-args]) != T_STRING)    Pike_error("Gz.crc32: illegal or missing argument 1 (expected string)\n");    if (sp[-args].u.string->size_shift)    Pike_error("Cannot input wide string to Gz.crc32\n");       if (args>1) { -  if (sp[1-args].type!=T_INT) +  if (TYPEOF(sp[1-args]) != T_INT)    Pike_error("Gz.crc32: illegal argument 2 (expected integer)\n");    else    crc=(unsigned INT32)sp[1-args].u.integer;    } else    crc=0;       crc=crc32(crc,    (unsigned char*)sp[-args].u.string->str,    DO_NOT_WARN((unsigned INT32)(sp[-args].u.string->len)));