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

version» Context lines:

pike.git/src/modules/Gz/zlibmod.c:592:       if(fail == Z_STREAM_END)    THIS->state=1;       pop_n_elems(args);       push_string(low_free_buf(&buf));   }       - static void init_gz_deflate(struct object *o) + static void init_gz_deflate(struct object *UNUSED(o))   {    mt_init(& THIS->lock);    MEMSET(& THIS->gz, 0, sizeof(THIS->gz));    THIS->gz.zalloc=Z_NULL;    THIS->gz.zfree=Z_NULL;    THIS->gz.opaque=(void *)THIS;    THIS->state=0;    deflateInit(& THIS->gz, THIS->level = Z_DEFAULT_COMPRESSION);    THIS->epilogue = NULL;   }    - static void exit_gz_deflate(struct object *o) + static void exit_gz_deflate(struct object *UNUSED(o))   {   /* mt_lock(& THIS->lock); */    deflateEnd(&THIS->gz);    do_free_string(THIS->epilogue);    do_free_string(THIS->dict);    THIS->dict = NULL;   /* mt_unlock(& THIS->lock); */    mt_destroy( & THIS->lock );   }   
pike.git/src/modules/Gz/zlibmod.c:1007:   static void gz_end_of_stream(INT32 args)   {    struct zipper *this=THIS;    pop_n_elems(args);    if(this->epilogue)    ref_push_string(this->epilogue);    else    push_int(0);   }    - static void init_gz_inflate(struct object *o) + static void init_gz_inflate(struct object *UNUSED(o))   {    mt_init(& THIS->lock);    MEMSET(& THIS->gz, 0, sizeof(THIS->gz));    THIS->gz.zalloc=Z_NULL;    THIS->gz.zfree=Z_NULL;    THIS->gz.opaque=(void *)THIS;    inflateInit(&THIS->gz);    inflateEnd(&THIS->gz);    THIS->epilogue = NULL;   }    - static void exit_gz_inflate(struct object *o) + static void exit_gz_inflate(struct object *UNUSED(o))   {   /* mt_lock(& THIS->lock); */    inflateEnd(& THIS->gz);    do_free_string(THIS->epilogue);    do_free_string(THIS->dict);    THIS->dict = NULL;   /* mt_unlock(& THIS->lock); */    mt_destroy( & THIS->lock );   }   
pike.git/src/modules/Gz/zlibmod.c:1070:    pop_n_elems(args);    push_int((INT32)crc);   }      /*! @endmodule    */   #endif      PIKE_MODULE_EXIT {}    + static void gz_deflate_size( INT32 args ) + { + #define L_CODES (256 + 29 + 1) + #define HEAP_SIZE (2*L_CODES+1) +  +  pop_n_elems(args); +  /* estimation, from reading deflate.h. We could get a rather exact +  * value if we saved memlevel + windowbits somewhere. +  */ +  push_int( +  /* internal_state structure, estimating alignment */ +  (47 * 4) + sizeof(void*)*16 + (4*HEAP_SIZE) + (4*121) + (4*(2*19+1)) + 16*2 + +  (2*L_CODES+1)*5 + +  /* d_buf <memlevel+6>, l_buf<memlevel+6>, window<windowbits>, hash<memlevel+7> */ +  16384*2 + 16384*2 + 65536*2 + 32768*2); + } +  + static void gz_inflate_size( INT32 args ) + { +  pop_n_elems(args); +  /* low-order estimation, from reading inflate.h */ +  push_int( +  /* inflate_state structure. */ +  ((28 * sizeof(void*)) + (320 * 2) + (288 * 2)) + +  /* codes[] */ +  (2048 * 4) + +  /* window, really 1<<wbits, max wbits is 16. */ +  65536); + } +    PIKE_MODULE_INIT   {   #ifdef HAVE_ZLIB_H    struct z_stream_s z; /* Used to detect support for extensions. */    int have_rle = 0;    int have_fixed = 0;       start_new_program();    ADD_STORAGE(struct zipper);       /* function(int|void,int|void:void) */    ADD_FUNCTION("create",gz_deflate_create,tFunc(tOr(tMapping, tOr(tInt,tVoid)) tOr(tInt,tVoid),tVoid),0);    /* function(string,int|void:string) */    ADD_FUNCTION("deflate",gz_deflate,tFunc(tStr tOr(tInt,tVoid),tStr),0); -  +  ADD_FUNCTION("_size_object", gz_deflate_size, tFunc(tVoid,tInt), 0);       add_integer_constant("NO_FLUSH",Z_NO_FLUSH,0);    add_integer_constant("PARTIAL_FLUSH",Z_PARTIAL_FLUSH,0);    add_integer_constant("SYNC_FLUSH",Z_SYNC_FLUSH,0);    add_integer_constant("FINISH",Z_FINISH,0);    add_integer_constant("DEFAULT_STRATEGY", Z_DEFAULT_STRATEGY,0);    add_integer_constant("FILTERED", Z_FILTERED,0);    add_integer_constant("HUFFMAN_ONLY", Z_HUFFMAN_ONLY,0);       MEMSET(&z, 0, sizeof(z));
pike.git/src/modules/Gz/zlibmod.c:1123: Inside #if defined(HAVE_ZLIB_H)
      start_new_program();    ADD_STORAGE(struct zipper);       /* function(int|void:void) */    ADD_FUNCTION("create",gz_inflate_create,tFunc(tOr(tMapping,tOr(tInt,tVoid)),tVoid),0);    /* function(string:string) */    ADD_FUNCTION("inflate",gz_inflate,tFunc(tStr,tStr),0);    /* function(:string) */    ADD_FUNCTION("end_of_stream",gz_end_of_stream,tFunc(tNone,tStr),0); +  ADD_FUNCTION("_size_object", gz_inflate_size, tFunc(tVoid,tInt), 0);       add_integer_constant("NO_FLUSH",Z_NO_FLUSH,0);    add_integer_constant("PARTIAL_FLUSH",Z_PARTIAL_FLUSH,0);    add_integer_constant("SYNC_FLUSH",Z_SYNC_FLUSH,0);    add_integer_constant("FINISH",Z_FINISH,0);       set_init_callback(init_gz_inflate);    set_exit_callback(exit_gz_inflate);       end_class("inflate",0);