X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6ebb51430cd8e4a9a11c6c5a5ca7c3ff9d7a72a..363f7de02bf781db135d920408f0b8354386e45a:/src/zlib/deflate.c?ds=sidebyside diff --git a/src/zlib/deflate.c b/src/zlib/deflate.c index d3d5558b1f..8cee4007ac 100644 --- a/src/zlib/deflate.c +++ b/src/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-1998 Jean-loup Gailly. + * Copyright (C) 1995-2002 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.1.2 Copyright 1995-1998 Jean-loup Gailly "; + " deflate 1.1.4 Copyright 1995-2002 Jean-loup Gailly "; /* 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 @@ -187,7 +187,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflateInit_(z_streamp strm, int level, const char* version, int stream_size) #else int ZEXPORT deflateInit_(strm, level, version, stream_size) @@ -203,7 +203,7 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size) } /* ========================================================================= */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char* version, int stream_size) #else @@ -251,7 +251,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, windowBits = -windowBits; } if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + windowBits < 9 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) { return Z_STREAM_ERROR; } @@ -297,7 +297,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, } /* ========================================================================= */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef* dictionary, uInt dictLength) #else int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) @@ -342,7 +342,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflateReset (z_streamp strm) #else int ZEXPORT deflateReset (strm) @@ -376,7 +376,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) #else int ZEXPORT deflateParams(strm, level, strategy) @@ -420,7 +420,7 @@ int ZEXPORT deflateParams(strm, level, strategy) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local void putShortMSB (deflate_state* s, uInt b) #else local void putShortMSB (s, b) @@ -438,7 +438,7 @@ local void putShortMSB (s, b) * to avoid allocating a large strm->next_out buffer and copying into it. * (See also read_buf()). */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local void flush_pending(z_streamp strm) #else local void flush_pending(strm) @@ -462,7 +462,7 @@ local void flush_pending(strm) } /* ========================================================================= */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflate (z_streamp strm, int flush) #else int ZEXPORT deflate (strm, flush) @@ -600,7 +600,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflateEnd (z_streamp strm) #else int ZEXPORT deflateEnd (strm) @@ -634,7 +634,7 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ int ZEXPORT deflateCopy (z_streamp dest, z_streamp source) #else int ZEXPORT deflateCopy (dest, source) @@ -649,11 +649,13 @@ int ZEXPORT deflateCopy (dest, source) deflate_state *ss; ushf *overlay; - ss = source->state; - if (source == Z_NULL || dest == Z_NULL || ss == Z_NULL) { + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { return Z_STREAM_ERROR; } + + ss = source->state; + *dest = *source; ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); @@ -698,7 +700,7 @@ int ZEXPORT deflateCopy (dest, source) * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local int read_buf(z_streamp strm, Bytef* buf, unsigned size) #else local int read_buf(strm, buf, size) @@ -727,7 +729,7 @@ local int read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local void lm_init (deflate_state* s) #else local void lm_init (s) @@ -770,7 +772,7 @@ local void lm_init (s) * match.S. The code will be functionally equivalent. */ #ifndef FASTEST -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local uInt longest_match(deflate_state* s, IPos cur_match) #else local uInt longest_match(s, cur_match) @@ -916,7 +918,7 @@ local uInt longest_match(s, cur_match) /* --------------------------------------------------------------------------- * Optimized version for level == 1 only */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local uInt longest_match(deflate_state* s, IPos cur_match) #else local uInt longest_match(s, cur_match) @@ -979,7 +981,7 @@ local uInt longest_match(s, cur_match) /* =========================================================================== * Check that the match at match_start is indeed a match. */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local void check_match(deflate_state* s, IPos start, IPos match, int length) #else local void check_match(s, start, match, length) @@ -1017,7 +1019,7 @@ local void check_match(s, start, match, length) * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local void fill_window(deflate_state* s) #else local void fill_window(s) @@ -1141,7 +1143,7 @@ local void fill_window(s) * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local block_state deflate_stored(deflate_state* s, int flush) #else local block_state deflate_stored(s, flush) @@ -1203,7 +1205,7 @@ local block_state deflate_stored(s, flush) * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local block_state deflate_fast(deflate_state* s, int flush) #else local block_state deflate_fast(s, flush) @@ -1303,7 +1305,7 @@ local block_state deflate_fast(s, flush) * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ -#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ local block_state deflate_slow(deflate_state* s, int flush) #else local block_state deflate_slow(s, flush)