Diff for /embedaddon/rsync/zlib/deflate.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/17 15:09:30 version 1.1.1.2, 2013/10/14 07:51:14
Line 1 Line 1
 /* deflate.c -- compress data using the deflation algorithm  /* deflate.c -- compress data using the deflation algorithm
 * Copyright (C) 1995-2005 Jean-loup Gailly. * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h   * For conditions of distribution and use, see copyright notice in zlib.h
  */   */
   
Line 37 Line 37
  *  REFERENCES   *  REFERENCES
  *   *
  *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".   *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
 *      Available in http://www.ietf.org/rfc/rfc1951.txt *      Available in http://tools.ietf.org/html/rfc1951
  *   *
  *      A description of the Rabin and Karp algorithm is given in the book   *      A description of the Rabin and Karp algorithm is given in the book
  *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.   *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
Line 54 Line 54
 #define read_buf dread_buf  #define read_buf dread_buf
   
 const char deflate_copyright[] =  const char deflate_copyright[] =
   " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";   " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
 /*  /*
   If you use the zlib library in a product, an acknowledgment is welcome    If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot    in the documentation of your product. If for some reason you cannot
Line 81  local block_state deflate_fast   OF((deflate_state *s, Line 81  local block_state deflate_fast   OF((deflate_state *s,
 #ifndef FASTEST  #ifndef FASTEST
 local block_state deflate_slow   OF((deflate_state *s, int flush));  local block_state deflate_slow   OF((deflate_state *s, int flush));
 #endif  #endif
   local block_state deflate_rle    OF((deflate_state *s, int flush));
   local block_state deflate_huff   OF((deflate_state *s, int flush));
 local void lm_init        OF((deflate_state *s));  local void lm_init        OF((deflate_state *s));
 local void putShortMSB    OF((deflate_state *s, uInt b));  local void putShortMSB    OF((deflate_state *s, uInt b));
 local void flush_pending  OF((z_streamp strm));  local void flush_pending  OF((z_streamp strm));
 local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));  local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));
 #ifndef FASTEST  
 #ifdef ASMV  #ifdef ASMV
       void match_init OF((void)); /* asm code initialization */        void match_init OF((void)); /* asm code initialization */
       uInt longest_match  OF((deflate_state *s, IPos cur_match));        uInt longest_match  OF((deflate_state *s, IPos cur_match));
 #else  #else
 local uInt longest_match  OF((deflate_state *s, IPos cur_match));  local uInt longest_match  OF((deflate_state *s, IPos cur_match));
 #endif  #endif
 #endif  
 local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));  
   
 #ifdef DEBUG  #ifdef DEBUG
 local  void check_match OF((deflate_state *s, IPos start, IPos match,  local  void check_match OF((deflate_state *s, IPos start, IPos match,
Line 112  local  void check_match OF((deflate_state *s, IPos sta Line 111  local  void check_match OF((deflate_state *s, IPos sta
 #endif  #endif
 /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */  /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
   
 #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)  
 /* Minimum amount of lookahead, except at the end of the input file.  
  * See deflate.c for comments about the MIN_MATCH+1.  
  */  
   
 /* Values for max_lazy_match, good_match and max_chain_length, depending on  /* Values for max_lazy_match, good_match and max_chain_length, depending on
  * the desired pack level (0..9). The values given below have been tuned to   * the desired pack level (0..9). The values given below have been tuned to
  * exclude worst case performance for pathological files. Better values may be   * exclude worst case performance for pathological files. Better values may be
Line 163  local const config configuration_table[10] = { Line 157  local const config configuration_table[10] = {
 struct static_tree_desc_s {int dummy;}; /* for buggy compilers */  struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
 #endif  #endif
   
   /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
   #define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
   
 /* ===========================================================================  /* ===========================================================================
  * Update a hash value with the given input byte   * Update a hash value with the given input byte
  * IN  assertion: all calls to to UPDATE_HASH are made with consecutive   * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
Line 243  int ZEXPORT deflateInit2_(strm, level, method, windowB Line 240  int ZEXPORT deflateInit2_(strm, level, method, windowB
   
     strm->msg = Z_NULL;      strm->msg = Z_NULL;
     if (strm->zalloc == (alloc_func)0) {      if (strm->zalloc == (alloc_func)0) {
   #ifdef Z_SOLO
           return Z_STREAM_ERROR;
   #else
         strm->zalloc = zcalloc;          strm->zalloc = zcalloc;
         strm->opaque = (voidpf)0;          strm->opaque = (voidpf)0;
   #endif
     }      }
    if (strm->zfree == (free_func)0) strm->zfree = zcfree;    if (strm->zfree == (free_func)0)
 #ifdef Z_SOLO
         return Z_STREAM_ERROR;
 #else
         strm->zfree = zcfree;
 #endif
   
 #ifdef FASTEST  #ifdef FASTEST
     if (level != 0) level = 1;      if (level != 0) level = 1;
Line 290  int ZEXPORT deflateInit2_(strm, level, method, windowB Line 296  int ZEXPORT deflateInit2_(strm, level, method, windowB
     s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));      s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
     s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));      s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
   
       s->high_water = 0;      /* nothing written to s->window yet */
   
     s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */      s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
   
     overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);      overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
Line 299  int ZEXPORT deflateInit2_(strm, level, method, windowB Line 307  int ZEXPORT deflateInit2_(strm, level, method, windowB
     if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||      if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
         s->pending_buf == Z_NULL) {          s->pending_buf == Z_NULL) {
         s->status = FINISH_STATE;          s->status = FINISH_STATE;
        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);        strm->msg = ERR_MSG(Z_MEM_ERROR);
         deflateEnd (strm);          deflateEnd (strm);
         return Z_MEM_ERROR;          return Z_MEM_ERROR;
     }      }
Line 320  int ZEXPORT deflateSetDictionary (strm, dictionary, di Line 328  int ZEXPORT deflateSetDictionary (strm, dictionary, di
     uInt  dictLength;      uInt  dictLength;
 {  {
     deflate_state *s;      deflate_state *s;
    uInt length = dictLength;    uInt str, n;
    uInt n;    int wrap;
    IPos hash_head = 0;    unsigned avail;
     z_const unsigned char *next;
   
    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
        strm->state->wrap == 2 || 
        (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) 
         return Z_STREAM_ERROR;          return Z_STREAM_ERROR;
   
     s = strm->state;      s = strm->state;
    if (s->wrap)    wrap = s->wrap;
     if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
         return Z_STREAM_ERROR;
 
     /* when using zlib wrappers, compute Adler-32 for provided dictionary */
     if (wrap == 1)
         strm->adler = adler32(strm->adler, dictionary, dictLength);          strm->adler = adler32(strm->adler, dictionary, dictLength);
       s->wrap = 0;                    /* avoid computing Adler-32 in read_buf */
   
    if (length < MIN_MATCH) return Z_OK;    /* if dictionary would fill window, just replace the history */
    if (length > MAX_DIST(s)) {    if (dictLength >= s->w_size) {
        length = MAX_DIST(s);        if (wrap == 0) {            /* already empty otherwise */
        dictionary += dictLength - length; /* use the tail of the dictionary */            CLEAR_HASH(s);
             s->strstart = 0;
             s->block_start = 0L;
             s->insert = 0;
         }
         dictionary += dictLength - s->w_size;  /* use the tail */
         dictLength = s->w_size;
     }      }
     zmemcpy(s->window, dictionary, length);  
     s->strstart = length;  
     s->block_start = (long)length;  
   
    /* Insert all strings in the hash table (except for the last two bytes).    /* insert dictionary into window and hash */
     * s->lookahead stays null, so s->ins_h will be recomputed at the next    avail = strm->avail_in;
     * call of fill_window.    next = strm->next_in;
     */    strm->avail_in = dictLength;
    s->ins_h = s->window[0];    strm->next_in = (z_const Bytef *)dictionary;
    UPDATE_HASH(s, s->ins_h, s->window[1]);    fill_window(s);
    for (n = 0; n <= length - MIN_MATCH; n++) {    while (s->lookahead >= MIN_MATCH) {
        INSERT_STRING(s, n, hash_head);        str = s->strstart;
         n = s->lookahead - (MIN_MATCH-1);
         do {
             UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
 #ifndef FASTEST
             s->prev[str & s->w_mask] = s->head[s->ins_h];
 #endif
             s->head[s->ins_h] = (Pos)str;
             str++;
         } while (--n);
         s->strstart = str;
         s->lookahead = MIN_MATCH-1;
         fill_window(s);
     }      }
    if (hash_head) hash_head = 0;  /* to make compiler happy */    s->strstart += s->lookahead;
     s->block_start = (long)s->strstart;
     s->insert = s->lookahead;
     s->lookahead = 0;
     s->match_length = s->prev_length = MIN_MATCH-1;
     s->match_available = 0;
     strm->next_in = next;
     strm->avail_in = avail;
     s->wrap = wrap;
     return Z_OK;      return Z_OK;
 }  }
   
 /* ========================================================================= */  /* ========================================================================= */
int ZEXPORT deflateReset (strm)int ZEXPORT deflateResetKeep (strm)
     z_streamp strm;      z_streamp strm;
 {  {
     deflate_state *s;      deflate_state *s;
Line 386  int ZEXPORT deflateReset (strm) Line 421  int ZEXPORT deflateReset (strm)
     s->last_flush = Z_NO_FLUSH;      s->last_flush = Z_NO_FLUSH;
   
     _tr_init(s);      _tr_init(s);
     lm_init(s);  
   
     return Z_OK;      return Z_OK;
 }  }
   
 /* ========================================================================= */  /* ========================================================================= */
   int ZEXPORT deflateReset (strm)
       z_streamp strm;
   {
       int ret;
   
       ret = deflateResetKeep(strm);
       if (ret == Z_OK)
           lm_init(strm->state);
       return ret;
   }
   
   /* ========================================================================= */
 int ZEXPORT deflateSetHeader (strm, head)  int ZEXPORT deflateSetHeader (strm, head)
     z_streamp strm;      z_streamp strm;
     gz_headerp head;      gz_headerp head;
Line 403  int ZEXPORT deflateSetHeader (strm, head) Line 449  int ZEXPORT deflateSetHeader (strm, head)
 }  }
   
 /* ========================================================================= */  /* ========================================================================= */
   int ZEXPORT deflatePending (strm, pending, bits)
       unsigned *pending;
       int *bits;
       z_streamp strm;
   {
       if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
       if (pending != Z_NULL)
           *pending = strm->state->pending;
       if (bits != Z_NULL)
           *bits = strm->state->bi_valid;
       return Z_OK;
   }
   
   /* ========================================================================= */
 int ZEXPORT deflatePrime (strm, bits, value)  int ZEXPORT deflatePrime (strm, bits, value)
     z_streamp strm;      z_streamp strm;
     int bits;      int bits;
     int value;      int value;
 {  {
       deflate_state *s;
       int put;
   
     if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;      if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
    strm->state->bi_valid = bits;    s = strm->state;
    strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));    if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
         return Z_BUF_ERROR;
     do {
         put = Buf_size - s->bi_valid;
         if (put > bits)
             put = bits;
         s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
         s->bi_valid += put;
         _tr_flush_bits(s);
         value >>= put;
         bits -= put;
     } while (bits);
     return Z_OK;      return Z_OK;
 }  }
   
Line 437  int ZEXPORT deflateParams(strm, level, strategy) Line 511  int ZEXPORT deflateParams(strm, level, strategy)
     }      }
     func = configuration_table[s->level].func;      func = configuration_table[s->level].func;
   
    if (func != configuration_table[level].func && strm->total_in != 0) {    if ((strategy != s->strategy || func != configuration_table[level].func) &&
         strm->total_in != 0) {
         /* Flush the last buffer: */          /* Flush the last buffer: */
        err = deflate(strm, Z_PARTIAL_FLUSH);        err = deflate(strm, Z_BLOCK);
         if (err == Z_BUF_ERROR && s->pending == 0)
             err = Z_OK;
     }      }
     if (s->level != level) {      if (s->level != level) {
         s->level = level;          s->level = level;
Line 483  int ZEXPORT deflateTune(strm, good_length, max_lazy, n Line 560  int ZEXPORT deflateTune(strm, good_length, max_lazy, n
  * resulting from using fixed blocks instead of stored blocks, which deflate   * resulting from using fixed blocks instead of stored blocks, which deflate
  * can emit on compressed data for some combinations of the parameters.   * can emit on compressed data for some combinations of the parameters.
  *   *
 * This function could be more sophisticated to provide closer upper bounds * This function could be more sophisticated to provide closer upper bounds for
 * for every combination of windowBits and memLevel, as well as wrap. * every combination of windowBits and memLevel.  But even the conservative
 * But even the conservative upper bound of about 14% expansion does not * upper bound of about 14% expansion does not seem onerous for output buffer
 * seem onerous for output buffer allocation. * allocation.
  */   */
 uLong ZEXPORT deflateBound(strm, sourceLen)  uLong ZEXPORT deflateBound(strm, sourceLen)
     z_streamp strm;      z_streamp strm;
     uLong sourceLen;      uLong sourceLen;
 {  {
     deflate_state *s;      deflate_state *s;
    uLong destLen;    uLong complen, wraplen;
     Bytef *str;
   
    /* conservative upper bound */    /* conservative upper bound for compressed data */
    destLen = sourceLen +    complen = sourceLen +
              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
   
    /* if can't get parameters, return conservative bound */    /* if can't get parameters, return conservative bound plus zlib wrapper */
     if (strm == Z_NULL || strm->state == Z_NULL)      if (strm == Z_NULL || strm->state == Z_NULL)
        return destLen;        return complen + 6;
   
    /* if not default parameters, return conservative bound */    /* compute wrapper length */
     s = strm->state;      s = strm->state;
       switch (s->wrap) {
       case 0:                                 /* raw deflate */
           wraplen = 0;
           break;
       case 1:                                 /* zlib wrapper */
           wraplen = 6 + (s->strstart ? 4 : 0);
           break;
       case 2:                                 /* gzip wrapper */
           wraplen = 18;
           if (s->gzhead != Z_NULL) {          /* user-supplied gzip header */
               if (s->gzhead->extra != Z_NULL)
                   wraplen += 2 + s->gzhead->extra_len;
               str = s->gzhead->name;
               if (str != Z_NULL)
                   do {
                       wraplen++;
                   } while (*str++);
               str = s->gzhead->comment;
               if (str != Z_NULL)
                   do {
                       wraplen++;
                   } while (*str++);
               if (s->gzhead->hcrc)
                   wraplen += 2;
           }
           break;
       default:                                /* for compiler happiness */
           wraplen = 6;
       }
   
       /* if not default parameters, return conservative bound */
     if (s->w_bits != 15 || s->hash_bits != 8 + 7)      if (s->w_bits != 15 || s->hash_bits != 8 + 7)
        return destLen;        return complen + wraplen;
   
     /* default settings: return tight bound for that case */      /* default settings: return tight bound for that case */
    return compressBound(sourceLen);    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
            (sourceLen >> 25) + 13 - 6 + wraplen;
 }  }
   
 /* =========================================================================  /* =========================================================================
Line 534  local void putShortMSB (s, b) Line 644  local void putShortMSB (s, b)
 local void flush_pending(strm)  local void flush_pending(strm)
     z_streamp strm;      z_streamp strm;
 {  {
    unsigned len = strm->state->pending;    unsigned len;
     deflate_state *s = strm->state;
   
       _tr_flush_bits(s);
       len = s->pending;
     if (len > strm->avail_out) len = strm->avail_out;      if (len > strm->avail_out) len = strm->avail_out;
     if (len == 0) return;      if (len == 0) return;
   
    zmemcpy(strm->next_out, strm->state->pending_out, len);    zmemcpy(strm->next_out, s->pending_out, len);
     strm->next_out  += len;      strm->next_out  += len;
    strm->state->pending_out  += len;    s->pending_out  += len;
     strm->total_out += len;      strm->total_out += len;
     strm->avail_out  -= len;      strm->avail_out  -= len;
    strm->state->pending -= len;    s->pending -= len;
    if (strm->state->pending == 0) {    if (s->pending == 0) {
        strm->state->pending_out = strm->state->pending_buf;        s->pending_out = s->pending_buf;
     }      }
 }  }
   
Line 559  int ZEXPORT deflate (strm, flush) Line 672  int ZEXPORT deflate (strm, flush)
     deflate_state *s;      deflate_state *s;
   
     if (strm == Z_NULL || strm->state == Z_NULL ||      if (strm == Z_NULL || strm->state == Z_NULL ||
        flush > Z_INSERT_ONLY || flush < 0) {        (flush > Z_BLOCK && flush != Z_INSERT_ONLY) || flush < 0) {
         return Z_STREAM_ERROR;          return Z_STREAM_ERROR;
     }      }
     s = strm->state;      s = strm->state;
Line 583  int ZEXPORT deflate (strm, flush) Line 696  int ZEXPORT deflate (strm, flush)
             put_byte(s, 31);              put_byte(s, 31);
             put_byte(s, 139);              put_byte(s, 139);
             put_byte(s, 8);              put_byte(s, 8);
            if (s->gzhead == NULL) {            if (s->gzhead == Z_NULL) {
                 put_byte(s, 0);                  put_byte(s, 0);
                 put_byte(s, 0);                  put_byte(s, 0);
                 put_byte(s, 0);                  put_byte(s, 0);
Line 610  int ZEXPORT deflate (strm, flush) Line 723  int ZEXPORT deflate (strm, flush)
                             (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?                              (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
                              4 : 0));                               4 : 0));
                 put_byte(s, s->gzhead->os & 0xff);                  put_byte(s, s->gzhead->os & 0xff);
                if (s->gzhead->extra != NULL) {                if (s->gzhead->extra != Z_NULL) {
                     put_byte(s, s->gzhead->extra_len & 0xff);                      put_byte(s, s->gzhead->extra_len & 0xff);
                     put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);                      put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
                 }                  }
Line 652  int ZEXPORT deflate (strm, flush) Line 765  int ZEXPORT deflate (strm, flush)
     }      }
 #ifdef GZIP  #ifdef GZIP
     if (s->status == EXTRA_STATE) {      if (s->status == EXTRA_STATE) {
        if (s->gzhead->extra != NULL) {        if (s->gzhead->extra != Z_NULL) {
             uInt beg = s->pending;  /* start of bytes to update crc */              uInt beg = s->pending;  /* start of bytes to update crc */
   
             while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {              while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
Line 680  int ZEXPORT deflate (strm, flush) Line 793  int ZEXPORT deflate (strm, flush)
             s->status = NAME_STATE;              s->status = NAME_STATE;
     }      }
     if (s->status == NAME_STATE) {      if (s->status == NAME_STATE) {
        if (s->gzhead->name != NULL) {        if (s->gzhead->name != Z_NULL) {
             uInt beg = s->pending;  /* start of bytes to update crc */              uInt beg = s->pending;  /* start of bytes to update crc */
             int val;              int val;
   
Line 711  int ZEXPORT deflate (strm, flush) Line 824  int ZEXPORT deflate (strm, flush)
             s->status = COMMENT_STATE;              s->status = COMMENT_STATE;
     }      }
     if (s->status == COMMENT_STATE) {      if (s->status == COMMENT_STATE) {
        if (s->gzhead->comment != NULL) {        if (s->gzhead->comment != Z_NULL) {
             uInt beg = s->pending;  /* start of bytes to update crc */              uInt beg = s->pending;  /* start of bytes to update crc */
             int val;              int val;
   
Line 773  int ZEXPORT deflate (strm, flush) Line 886  int ZEXPORT deflate (strm, flush)
      * flushes. For repeated and useless calls with Z_FINISH, we keep       * flushes. For repeated and useless calls with Z_FINISH, we keep
      * returning Z_STREAM_END instead of Z_BUF_ERROR.       * returning Z_STREAM_END instead of Z_BUF_ERROR.
      */       */
    } else if (strm->avail_in == 0 && flush <= old_flush &&    } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
                flush != Z_FINISH) {                 flush != Z_FINISH) {
         ERR_RETURN(strm, Z_BUF_ERROR);          ERR_RETURN(strm, Z_BUF_ERROR);
     }      }
Line 789  int ZEXPORT deflate (strm, flush) Line 902  int ZEXPORT deflate (strm, flush)
         (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {          (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
         block_state bstate;          block_state bstate;
   
        bstate = (*(configuration_table[s->level].func))(s, flush);        bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
                     (s->strategy == Z_RLE ? deflate_rle(s, flush) :
                         (*(configuration_table[s->level].func))(s, flush));
   
         if (bstate == finish_started || bstate == finish_done) {          if (bstate == finish_started || bstate == finish_done) {
             s->status = FINISH_STATE;              s->status = FINISH_STATE;
Line 810  int ZEXPORT deflate (strm, flush) Line 925  int ZEXPORT deflate (strm, flush)
         if (bstate == block_done) {          if (bstate == block_done) {
             if (flush == Z_PARTIAL_FLUSH) {              if (flush == Z_PARTIAL_FLUSH) {
                 _tr_align(s);                  _tr_align(s);
            } else { /* FULL_FLUSH or SYNC_FLUSH */            } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
                 _tr_stored_block(s, (char*)0, 0L, 0);                  _tr_stored_block(s, (char*)0, 0L, 0);
                 /* For a full flush, this empty block will be recognized                  /* For a full flush, this empty block will be recognized
                  * as a special marker by inflate_sync().                   * as a special marker by inflate_sync().
                  */                   */
                 if (flush == Z_FULL_FLUSH) {                  if (flush == Z_FULL_FLUSH) {
                     CLEAR_HASH(s);             /* forget history */                      CLEAR_HASH(s);             /* forget history */
                       if (s->lookahead == 0) {
                           s->strstart = 0;
                           s->block_start = 0L;
                           s->insert = 0;
                       }
                 }                  }
             }              }
             flush_pending(strm);              flush_pending(strm);
Line 911  int ZEXPORT deflateCopy (dest, source) Line 1031  int ZEXPORT deflateCopy (dest, source)
   
     ss = source->state;      ss = source->state;
   
    zmemcpy(dest, source, sizeof(z_stream));    zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
   
     ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));      ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
     if (ds == Z_NULL) return Z_MEM_ERROR;      if (ds == Z_NULL) return Z_MEM_ERROR;
     dest->state = (struct internal_state FAR *) ds;      dest->state = (struct internal_state FAR *) ds;
    zmemcpy(ds, ss, sizeof(deflate_state));    zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
     ds->strm = dest;      ds->strm = dest;
   
     ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));      ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
Line 932  int ZEXPORT deflateCopy (dest, source) Line 1052  int ZEXPORT deflateCopy (dest, source)
     }      }
     /* following zmemcpy do not work for 16-bit MSDOS */      /* following zmemcpy do not work for 16-bit MSDOS */
     zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));      zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
    zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));    zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));    zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
     zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);      zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
   
     ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);      ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
Line 967  local int read_buf(strm, buf, size) Line 1087  local int read_buf(strm, buf, size)
   
     strm->avail_in  -= len;      strm->avail_in  -= len;
   
       zmemcpy(buf, strm->next_in, len);
     if (strm->state->wrap == 1) {      if (strm->state->wrap == 1) {
        strm->adler = adler32(strm->adler, strm->next_in, len);        strm->adler = adler32(strm->adler, buf, len);
     }      }
 #ifdef GZIP  #ifdef GZIP
     else if (strm->state->wrap == 2) {      else if (strm->state->wrap == 2) {
        strm->adler = crc32(strm->adler, strm->next_in, len);        strm->adler = crc32(strm->adler, buf, len);
     }      }
 #endif  #endif
     zmemcpy(buf, strm->next_in, len);  
     strm->next_in  += len;      strm->next_in  += len;
     strm->total_in += len;      strm->total_in += len;
   
Line 1002  local void lm_init (s) Line 1122  local void lm_init (s)
     s->strstart = 0;      s->strstart = 0;
     s->block_start = 0L;      s->block_start = 0L;
     s->lookahead = 0;      s->lookahead = 0;
       s->insert = 0;
     s->match_length = s->prev_length = MIN_MATCH-1;      s->match_length = s->prev_length = MIN_MATCH-1;
     s->match_available = 0;      s->match_available = 0;
     s->ins_h = 0;      s->ins_h = 0;
Line 1169  local uInt longest_match(s, cur_match) Line 1290  local uInt longest_match(s, cur_match)
     return s->lookahead;      return s->lookahead;
 }  }
 #endif /* ASMV */  #endif /* ASMV */
 #endif /* FASTEST */  
   
   #else /* FASTEST */
   
 /* ---------------------------------------------------------------------------  /* ---------------------------------------------------------------------------
 * Optimized version for level == 1 or strategy == Z_RLE only * Optimized version for FASTEST only
  */   */
local uInt longest_match_fast(s, cur_match)local uInt longest_match(s, cur_match)
     deflate_state *s;      deflate_state *s;
     IPos cur_match;                             /* current match */      IPos cur_match;                             /* current match */
 {  {
Line 1227  local uInt longest_match_fast(s, cur_match) Line 1349  local uInt longest_match_fast(s, cur_match)
     return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;      return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
 }  }
   
   #endif /* FASTEST */
   
 #ifdef DEBUG  #ifdef DEBUG
 /* ===========================================================================  /* ===========================================================================
  * Check that the match at match_start is indeed a match.   * Check that the match at match_start is indeed a match.
Line 1273  local void fill_window(s) Line 1397  local void fill_window(s)
     unsigned more;    /* Amount of free space at the end of the window. */      unsigned more;    /* Amount of free space at the end of the window. */
     uInt wsize = s->w_size;      uInt wsize = s->w_size;
   
       Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
   
     do {      do {
         more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);          more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
   
Line 1305  local void fill_window(s) Line 1431  local void fill_window(s)
                later. (Using level 0 permanently is not an optimal usage of                 later. (Using level 0 permanently is not an optimal usage of
                zlib, so we don't care about this pathological case.)                 zlib, so we don't care about this pathological case.)
              */               */
             /* %%% avoid this when Z_RLE */  
             n = s->hash_size;              n = s->hash_size;
             p = &s->head[n];              p = &s->head[n];
             do {              do {
Line 1326  local void fill_window(s) Line 1451  local void fill_window(s)
 #endif  #endif
             more += wsize;              more += wsize;
         }          }
        if (s->strm->avail_in == 0) return;        if (s->strm->avail_in == 0) break;
   
         /* If there was no sliding:          /* If there was no sliding:
          *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&           *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
Line 1345  local void fill_window(s) Line 1470  local void fill_window(s)
         s->lookahead += n;          s->lookahead += n;
   
         /* Initialize the hash value now that we have some input: */          /* Initialize the hash value now that we have some input: */
        if (s->lookahead >= MIN_MATCH) {        if (s->lookahead + s->insert >= MIN_MATCH) {
            s->ins_h = s->window[s->strstart];            uInt str = s->strstart - s->insert;
            UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);            s->ins_h = s->window[str];
             UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
 #if MIN_MATCH != 3  #if MIN_MATCH != 3
             Call UPDATE_HASH() MIN_MATCH-3 more times              Call UPDATE_HASH() MIN_MATCH-3 more times
 #endif  #endif
               while (s->insert) {
                   UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
   #ifndef FASTEST
                   s->prev[str & s->w_mask] = s->head[s->ins_h];
   #endif
                   s->head[s->ins_h] = (Pos)str;
                   str++;
                   s->insert--;
                   if (s->lookahead + s->insert < MIN_MATCH)
                       break;
               }
         }          }
         /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,          /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
          * but this is not important since only literal bytes will be emitted.           * but this is not important since only literal bytes will be emitted.
          */           */
   
     } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);      } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
   
       /* If the WIN_INIT bytes after the end of the current data have never been
        * written, then zero those bytes in order to avoid memory check reports of
        * the use of uninitialized (or uninitialised as Julian writes) bytes by
        * the longest match routines.  Update the high water mark for the next
        * time through here.  WIN_INIT is set to MAX_MATCH since the longest match
        * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
        */
       if (s->high_water < s->window_size) {
           ulg curr = s->strstart + (ulg)(s->lookahead);
           ulg init;
   
           if (s->high_water < curr) {
               /* Previous high water mark below current data -- zero WIN_INIT
                * bytes or up to end of window, whichever is less.
                */
               init = s->window_size - curr;
               if (init > WIN_INIT)
                   init = WIN_INIT;
               zmemzero(s->window + curr, (unsigned)init);
               s->high_water = curr + init;
           }
           else if (s->high_water < (ulg)curr + WIN_INIT) {
               /* High water mark at or above current data, but below current data
                * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
                * to end of window, whichever is less.
                */
               init = (ulg)curr + WIN_INIT - s->high_water;
               if (init > s->window_size - s->high_water)
                   init = s->window_size - s->high_water;
               zmemzero(s->window + s->high_water, (unsigned)init);
               s->high_water += init;
           }
       }
   
       Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
              "not enough room for search");
 }  }
   
 /* ===========================================================================  /* ===========================================================================
  * Flush the current block, with given end-of-file flag.   * Flush the current block, with given end-of-file flag.
  * IN assertion: strstart is set to the end of the current match.   * IN assertion: strstart is set to the end of the current match.
  */   */
#define FLUSH_BLOCK_ONLY(s, eof) { \#define FLUSH_BLOCK_ONLY(s, last) { \
    _tr_flush_block(s, (s->block_start >= 0L ? \     _tr_flush_block(s, (s->block_start >= 0L ? \
                    (charf *)&s->window[(unsigned)s->block_start] : \                     (charf *)&s->window[(unsigned)s->block_start] : \
                    (charf *)Z_NULL), \                     (charf *)Z_NULL), \
                 (ulg)((long)s->strstart - s->block_start), \                  (ulg)((long)s->strstart - s->block_start), \
                (eof)); \                (last)); \
    s->block_start = s->strstart; \     s->block_start = s->strstart; \
    flush_pending(s->strm); \     flush_pending(s->strm); \
    Tracev((stderr,"[FLUSH]")); \     Tracev((stderr,"[FLUSH]")); \
 }  }
   
 /* Same but force premature exit if necessary. */  /* Same but force premature exit if necessary. */
#define FLUSH_BLOCK(s, eof) { \#define FLUSH_BLOCK(s, last) { \
   FLUSH_BLOCK_ONLY(s, eof); \   FLUSH_BLOCK_ONLY(s, last); \
   if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
 }  }
   
 /* ===========================================================================  /* ===========================================================================
Line 1441  local block_state deflate_stored(s, flush) Line 1615  local block_state deflate_stored(s, flush)
             FLUSH_BLOCK(s, 0);              FLUSH_BLOCK(s, 0);
         }          }
     }      }
       s->insert = 0;
     if (flush == Z_INSERT_ONLY) {      if (flush == Z_INSERT_ONLY) {
         s->block_start = s->strstart;          s->block_start = s->strstart;
         return need_more;          return need_more;
     }      }
    if (flush == Z_FINISH) {
    FLUSH_BLOCK(s, flush == Z_FINISH);        FLUSH_BLOCK(s, 1);
    return flush == Z_FINISH ? finish_done : block_done;        return finish_done;
     }
     if ((long)s->strstart > s->block_start)
         FLUSH_BLOCK(s, 0);
     return block_done;
 }  }
   
 /* ===========================================================================  /* ===========================================================================
Line 1461  local block_state deflate_fast(s, flush) Line 1640  local block_state deflate_fast(s, flush)
     deflate_state *s;      deflate_state *s;
     int flush;      int flush;
 {  {
    IPos hash_head = NIL; /* head of the hash chain */    IPos hash_head;       /* head of the hash chain */
     int bflush;           /* set if current block must be flushed */      int bflush;           /* set if current block must be flushed */
   
     for (;;) {      for (;;) {
Line 1481  local block_state deflate_fast(s, flush) Line 1660  local block_state deflate_fast(s, flush)
         /* Insert the string window[strstart .. strstart+2] in the          /* Insert the string window[strstart .. strstart+2] in the
          * dictionary, and set hash_head to the head of the hash chain:           * dictionary, and set hash_head to the head of the hash chain:
          */           */
           hash_head = NIL;
         if (s->lookahead >= MIN_MATCH) {          if (s->lookahead >= MIN_MATCH) {
             INSERT_STRING(s, s->strstart, hash_head);              INSERT_STRING(s, s->strstart, hash_head);
         }          }
Line 1499  local block_state deflate_fast(s, flush) Line 1679  local block_state deflate_fast(s, flush)
              * of window index 0 (in particular we have to avoid a match               * of window index 0 (in particular we have to avoid a match
              * of the string with itself at the start of the input file).               * of the string with itself at the start of the input file).
              */               */
#ifdef FASTEST            s->match_length = longest_match (s, hash_head);
            if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) ||            /* longest_match() sets match_start */
                (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { 
                s->match_length = longest_match_fast (s, hash_head); 
            } 
#else 
            if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { 
                s->match_length = longest_match (s, hash_head); 
            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { 
                s->match_length = longest_match_fast (s, hash_head); 
            } 
#endif 
            /* longest_match() or longest_match_fast() sets match_start */ 
         }          }
         if (s->match_length >= MIN_MATCH) {          if (s->match_length >= MIN_MATCH) {
             check_match(s, s->strstart, s->match_start, s->match_length);              check_match(s, s->strstart, s->match_start, s->match_length);
Line 1563  local block_state deflate_fast(s, flush) Line 1732  local block_state deflate_fast(s, flush)
         s->block_start = s->strstart;          s->block_start = s->strstart;
         return need_more;          return need_more;
     }      }
    FLUSH_BLOCK(s, flush == Z_FINISH);    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
    return flush == Z_FINISH ? finish_done : block_done;    if (flush == Z_FINISH) {
         FLUSH_BLOCK(s, 1);
         return finish_done;
     }
     if (s->last_lit)
         FLUSH_BLOCK(s, 0);
     return block_done;
 }  }
   
 #ifndef FASTEST  #ifndef FASTEST
Line 1577  local block_state deflate_slow(s, flush) Line 1752  local block_state deflate_slow(s, flush)
     deflate_state *s;      deflate_state *s;
     int flush;      int flush;
 {  {
    IPos hash_head = NIL;    /* head of hash chain */    IPos hash_head;          /* head of hash chain */
     int bflush;              /* set if current block must be flushed */      int bflush;              /* set if current block must be flushed */
   
     /* Process the input block. */      /* Process the input block. */
Line 1598  local block_state deflate_slow(s, flush) Line 1773  local block_state deflate_slow(s, flush)
         /* Insert the string window[strstart .. strstart+2] in the          /* Insert the string window[strstart .. strstart+2] in the
          * dictionary, and set hash_head to the head of the hash chain:           * dictionary, and set hash_head to the head of the hash chain:
          */           */
           hash_head = NIL;
         if (s->lookahead >= MIN_MATCH) {          if (s->lookahead >= MIN_MATCH) {
             INSERT_STRING(s, s->strstart, hash_head);              INSERT_STRING(s, s->strstart, hash_head);
         }          }
Line 1619  local block_state deflate_slow(s, flush) Line 1795  local block_state deflate_slow(s, flush)
              * of window index 0 (in particular we have to avoid a match               * of window index 0 (in particular we have to avoid a match
              * of the string with itself at the start of the input file).               * of the string with itself at the start of the input file).
              */               */
            if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {            s->match_length = longest_match (s, hash_head);
                s->match_length = longest_match (s, hash_head);            /* longest_match() sets match_start */
            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { 
                s->match_length = longest_match_fast (s, hash_head); 
            } 
            /* longest_match() or longest_match_fast() sets match_start */ 
   
             if (s->match_length <= 5 && (s->strategy == Z_FILTERED              if (s->match_length <= 5 && (s->strategy == Z_FILTERED
 #if TOO_FAR <= 32767  #if TOO_FAR <= 32767
Line 1701  local block_state deflate_slow(s, flush) Line 1873  local block_state deflate_slow(s, flush)
         _tr_tally_lit(s, s->window[s->strstart-1], bflush);          _tr_tally_lit(s, s->window[s->strstart-1], bflush);
         s->match_available = 0;          s->match_available = 0;
     }      }
    FLUSH_BLOCK(s, flush == Z_FINISH);    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
    return flush == Z_FINISH ? finish_done : block_done;    if (flush == Z_FINISH) {
         FLUSH_BLOCK(s, 1);
         return finish_done;
     }
     if (s->last_lit)
         FLUSH_BLOCK(s, 0);
     return block_done;
 }  }
 #endif /* FASTEST */  #endif /* FASTEST */
   
 #if 0  
 /* ===========================================================================  /* ===========================================================================
  * For Z_RLE, simply look for runs of bytes, generate matches only of distance   * For Z_RLE, simply look for runs of bytes, generate matches only of distance
  * one.  Do not maintain a hash table.  (It will be regenerated if this run of   * one.  Do not maintain a hash table.  (It will be regenerated if this run of
Line 1716  local block_state deflate_rle(s, flush) Line 1893  local block_state deflate_rle(s, flush)
     deflate_state *s;      deflate_state *s;
     int flush;      int flush;
 {  {
    int bflush;         /* set if current block must be flushed */    int bflush;             /* set if current block must be flushed */
    uInt run;           /* length of run */    uInt prev;              /* byte at distance one to match */
    uInt max;           /* maximum length of run */    Bytef *scan, *strend;   /* scan goes up to strend for length of run */
    uInt prev;          /* byte at distance one to match */ 
    Bytef *scan;        /* scan for end of run */ 
   
     for (;;) {      for (;;) {
         /* Make sure that we always have enough lookahead, except          /* Make sure that we always have enough lookahead, except
          * at the end of the input file. We need MAX_MATCH bytes           * at the end of the input file. We need MAX_MATCH bytes
         * for the longest encodable run.         * for the longest run, plus one for the unrolled loop.
          */           */
        if (s->lookahead < MAX_MATCH) {        if (s->lookahead <= MAX_MATCH) {
             fill_window(s);              fill_window(s);
            if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {            if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
                 return need_more;                  return need_more;
             }              }
             if (s->lookahead == 0) break; /* flush the current block */              if (s->lookahead == 0) break; /* flush the current block */
         }          }
   
         /* See how many times the previous byte repeats */          /* See how many times the previous byte repeats */
        run = 0;        s->match_length = 0;
        if (s->strstart > 0) {      /* if there is a previous byte, that is */        if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
            max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH; 
             scan = s->window + s->strstart - 1;              scan = s->window + s->strstart - 1;
            prev = *scan++;            prev = *scan;
            do {            if (prev == *++scan && prev == *++scan && prev == *++scan) {
                if (*scan++ != prev)                strend = s->window + s->strstart + MAX_MATCH;
                    break;                do {
            } while (++run < max);                } while (prev == *++scan && prev == *++scan &&
                          prev == *++scan && prev == *++scan &&
                          prev == *++scan && prev == *++scan &&
                          prev == *++scan && prev == *++scan &&
                          scan < strend);
                 s->match_length = MAX_MATCH - (int)(strend - scan);
                 if (s->match_length > s->lookahead)
                     s->match_length = s->lookahead;
             }
             Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
         }          }
   
         /* Emit match if have run of MIN_MATCH or longer, else emit literal */          /* Emit match if have run of MIN_MATCH or longer, else emit literal */
        if (run >= MIN_MATCH) {        if (s->match_length >= MIN_MATCH) {
            check_match(s, s->strstart, s->strstart - 1, run);            check_match(s, s->strstart, s->strstart - 1, s->match_length);
            _tr_tally_dist(s, 1, run - MIN_MATCH, bflush);
            s->lookahead -= run;            _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
            s->strstart += run;
             s->lookahead -= s->match_length;
             s->strstart += s->match_length;
             s->match_length = 0;
         } else {          } else {
             /* No match, output a literal byte */              /* No match, output a literal byte */
             Tracevv((stderr,"%c", s->window[s->strstart]));              Tracevv((stderr,"%c", s->window[s->strstart]));
Line 1762  local block_state deflate_rle(s, flush) Line 1948  local block_state deflate_rle(s, flush)
         }          }
         if (bflush) FLUSH_BLOCK(s, 0);          if (bflush) FLUSH_BLOCK(s, 0);
     }      }
    FLUSH_BLOCK(s, flush == Z_FINISH);    s->insert = 0;
    return flush == Z_FINISH ? finish_done : block_done;    if (flush == Z_FINISH) {
         FLUSH_BLOCK(s, 1);
         return finish_done;
     }
     if (s->last_lit)
         FLUSH_BLOCK(s, 0);
     return block_done;
 }  }
#endif
 /* ===========================================================================
  * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.
  * (It will be regenerated if this run of deflate switches away from Huffman.)
  */
 local block_state deflate_huff(s, flush)
     deflate_state *s;
     int flush;
 {
     int bflush;             /* set if current block must be flushed */
 
     for (;;) {
         /* Make sure that we have a literal to write. */
         if (s->lookahead == 0) {
             fill_window(s);
             if (s->lookahead == 0) {
                 if (flush == Z_NO_FLUSH)
                     return need_more;
                 break;      /* flush the current block */
             }
         }
 
         /* Output a literal byte */
         s->match_length = 0;
         Tracevv((stderr,"%c", s->window[s->strstart]));
         _tr_tally_lit (s, s->window[s->strstart], bflush);
         s->lookahead--;
         s->strstart++;
         if (bflush) FLUSH_BLOCK(s, 0);
     }
     s->insert = 0;
     if (flush == Z_FINISH) {
         FLUSH_BLOCK(s, 1);
         return finish_done;
     }
     if (s->last_lit)
         FLUSH_BLOCK(s, 0);
     return block_done;
 }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>