Branch: Tag:

1997-11-11

1997-11-11 03:56:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Improved handling of Z_BUF_ERROR in deflate().

Rev: src/modules/Gz/zlibmod.c:1.17

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: zlibmod.c,v 1.16 1997/11/11 03:12:04 grubba Exp $"); + RCSID("$Id: zlibmod.c,v 1.17 1997/11/11 03:56:25 grubba Exp $");      #include "zlib_machine.h"   
37:   };      #define BUF 32768 + #define MAX_BUF (64*BUF)      #define THIS ((struct zipper *)(fp->current_storage))   
106:    char *loc;    int ret;    loc=low_make_buf_space(BUF,buf); -  THREADS_ALLOW(); +     this->gz.next_out=(Bytef *)loc;    this->gz.avail_out=BUF; -  +  while (1) { +  THREADS_ALLOW();    ret=deflate(& this->gz, flush);    THREADS_DISALLOW(); -  +  if ((ret != Z_BUF_ERROR) || (this->gz.avail_out > MAX_BUF)) { +  break; +  } +  low_make_buf_space(BUF, buf); +  this->gz.avail_out += BUF; +  }    low_make_buf_space(-this->gz.avail_out,buf);    if(ret != Z_OK)    {