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

version» Context lines:

pike.git/src/modules/Gz/zlibmod.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: zlibmod.c,v 1.88 2009/08/30 15:58:54 grubba Exp $ + || $Id: zlibmod.c,v 1.89 2010/06/24 18:56:11 jonasw Exp $   */      #include "global.h"   #include "zlib_machine.h"   #include "module.h"   #include "program.h"   #include "module_support.h"      #if !defined(HAVE_LIBZ) && !defined(HAVE_LIBGZ)   #undef HAVE_ZLIB_H
pike.git/src/modules/Gz/zlibmod.c:454:    *! @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:482:    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)    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)    Pike_error("Bad argument 2 to gz_deflate->deflate()\n");       flush=sp[1-args].u.integer;       switch(flush)    {
pike.git/src/modules/Gz/zlibmod.c:778:   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)    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)    raw = Pike_sp[1-args].u.integer;    else    SIMPLE_BAD_ARG_ERROR("uncompress", 2, "int");    }       initialize_buf(&buf);    SET_ONERROR(err, toss_buffer, &buf);
pike.git/src/modules/Gz/zlibmod.c:834:    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)    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);       SET_ONERROR(err,toss_buffer,&buf);    fail=do_inflate(&buf,this,Z_SYNC_FLUSH);    UNSET_ONERROR(err);   
pike.git/src/modules/Gz/zlibmod.c:926:   /* mt_unlock(& THIS->lock); */    mt_destroy( & THIS->lock );   }      /*! @endclass    */      /*! @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)    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)    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,