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

version» Context lines:

pike.git/src/modules/Gz/zlibmod.c:407:    deflateEnd(&z.gz);    mt_destroy(&z.lock);       if(ret != Z_STREAM_END)    Pike_error("Error while deflating data (%d).\n",ret);   }      /*! @endclass    */    - /*! @decl string compress(string data, void|int(0..1) raw, @ -  *! void|int(0..9) level, void|int strategy, @ -  *! void|int(8..15) window_size) + /*! @decl string(8bit) compress(string(8bit) data, void|int(0..1) raw, @ +  *! void|int(0..9) level, void|int strategy, @ +  *! void|int(8..15) window_size)    *!    *! Encodes and returns the input @[data] according to the deflate    *! format defined in RFC 1951.    *!    *! @param data    *! The data to be encoded.    *!    *! @param raw    *! If set, the data is encoded without the header and footer    *! defined in RFC 1950. Example of uses is the ZIP container
pike.git/src/modules/Gz/zlibmod.c:491:    zlibmod_pack(data, &buf, level, strategy, wbits);    UNSET_ONERROR(err);       pop_n_elems(args);    push_string(low_free_buf(&buf));   }      /*! @class deflate    */    - /*! @decl string deflate(string data, int|void flush) + /*! @decl string(8bit) deflate(string(8bit) data, int|void flush)    *!    *! This function performs gzip style compression on a string @[data] and    *! returns the packed data. Streaming can be done by calling this    *! function several times and concatenating the returned data.    *!    *! The optional argument @[flush] should be one of the following:    *! @int    *! @value Gz.NO_FLUSH    *! Only data that doesn't fit in the internal buffers is returned.    *! @value Gz.PARTIAL_FLUSH    *! All input is packed and returned.    *! @value Gz.SYNC_FLUSH    *! All input is packed and returned.    *! @value Gz.FINISH    *! All input is packed and an 'end of data' marker is appended.    *! @endint    *! -  *! @note -  *! Data must not be wide string. -  *! +     *! @seealso    *! @[Gz.inflate->inflate()]    */   static void gz_deflate(INT32 args)   {    struct pike_string *data;    int flush, fail;    struct zipper *this=THIS;    dynamic_buffer buf;    ONERROR err;
pike.git/src/modules/Gz/zlibmod.c:866:       if(ret==Z_OK)    Pike_error("Compressed data is truncated.\n");    if(ret!=Z_STREAM_END)    Pike_error("Failed to inflate data (%d).\n", ret);   }      /*! @endclass   */    - /*! @decl string uncompress(string data, void|int(0..1) raw) + /*! @decl string(8bit) uncompress(string(8bit) data, void|int(0..1) raw)    *!    *! Uncompresses the @[data] and returns it. The @[raw] parameter    *! tells the decoder that the indata lacks the data header and footer    *! defined in RFC 1950.    */   static void gz_uncompress(INT32 args)   {    dynamic_buffer buf;    ONERROR err;    int raw = 0;
pike.git/src/modules/Gz/zlibmod.c:905:    UNSET_ONERROR(err);       pop_n_elems(args);    push_string(low_free_buf(&buf));      }      /*! @class inflate    */    - /*! @decl string inflate(string data) + /*! @decl string(8bit) inflate(string(8bit) data)    *!    *! This function performs gzip style decompression. It can inflate    *! a whole file at once or in blocks.    *!    *! @example    *! // whole file    *! write(Gz.inflate()->inflate(stdin->read(0x7fffffff));    *!    *! // streaming (blocks)    *! function inflate=Gz.inflate()->inflate;
pike.git/src/modules/Gz/zlibmod.c:989:    pop_stack();    }       if(fail != Z_STREAM_END && fail!=Z_OK && !sp[-1].u.string->len)    {    pop_stack();    push_int(0);    }   }    - /*! @decl string end_of_stream() + /*! @decl string(8bit) end_of_stream()    *!    *! This function returns 0 if the end of stream marker has not yet    *! been encountered, or a string (possibly empty) containg any extra data    *! received following the end of stream marker if the marker has been    *! encountered. If the extra data is not needed, the result of this    *! function can be treated as a logical value.    */   static void gz_end_of_stream(INT32 args)   {    struct zipper *this=THIS;
pike.git/src/modules/Gz/zlibmod.c:1033:    do_free_string(THIS->epilogue);    do_free_string(THIS->dict);    THIS->dict = NULL;   /* mt_unlock(& THIS->lock); */    mt_destroy( & THIS->lock );   }      /*! @endclass    */    - /*! @decl int crc32(string data, void|int start_value) + /*! @decl int crc32(string(8bit) 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 || 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) {
pike.git/src/modules/Gz/zlibmod.c:1112: Inside #if defined(HAVE_ZLIB_H)
  #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); +  /* function(string(8bit),int|void:string(8bit)) */ +  ADD_FUNCTION("deflate",gz_deflate,tFunc(tStr8 tOr(tInt,tVoid),tStr8),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);   
pike.git/src/modules/Gz/zlibmod.c:1150: Inside #if defined(HAVE_ZLIB_H)
   set_init_callback(init_gz_deflate);    set_exit_callback(exit_gz_deflate);       end_class("deflate",0);       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); +  /* function(string(8bit):string(8bit)) */ +  ADD_FUNCTION("inflate",gz_inflate,tFunc(tStr8,tStr8),0); +  /* function(:string(8bit)) */ +  ADD_FUNCTION("end_of_stream",gz_end_of_stream,tFunc(tNone,tStr8),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);   
pike.git/src/modules/Gz/zlibmod.c:1184: Inside #if defined(HAVE_ZLIB_H) and #if defined(Z_RLE)
   if (have_rle) {    add_integer_constant("RLE", Z_RLE,0);    }   #endif   #ifdef Z_FIXED    if (have_fixed) {    add_integer_constant("FIXED", Z_FIXED,0);    }   #endif    -  /* function(string,void|int:int) */ -  ADD_FUNCTION("crc32",gz_crc32,tFunc(tStr tOr(tVoid,tInt),tInt),0); +  /* function(string(8bit),void|int:int) */ +  ADD_FUNCTION("crc32",gz_crc32,tFunc(tStr8 tOr(tVoid,tInt),tInt),0);    -  /* function(string,void|int(0..1),void|int,void|int:string) */ -  ADD_FUNCTION("compress",gz_compress,tFunc(tStr tOr(tVoid,tInt01) tOr(tVoid,tInt09) tOr(tVoid,tInt) tOr(tVoid,tInt),tStr),0); +  /* function(string(8bit),void|int(0..1),void|int,void|int:string(8bit)) */ +  ADD_FUNCTION("compress",gz_compress,tFunc(tStr8 tOr(tVoid,tInt01) tOr(tVoid,tInt09) tOr(tVoid,tInt) tOr(tVoid,tInt),tStr8),0);    -  /* function(string,void|int(0..1):string) */ -  ADD_FUNCTION("uncompress",gz_uncompress,tFunc(tStr tOr(tVoid,tInt01),tStr),0); +  /* function(string(8bit),void|int(0..1):string(8bit)) */ +  ADD_FUNCTION("uncompress",gz_uncompress,tFunc(tStr8 tOr(tVoid,tInt01),tStr8),0);       PIKE_MODULE_EXPORT(Gz, crc32);    PIKE_MODULE_EXPORT(Gz, zlibmod_pack);    PIKE_MODULE_EXPORT(Gz, zlibmod_unpack);   #else    if(!TEST_COMPAT(7,6))    HIDE_MODULE();   #endif   }