diff options
| -rw-r--r-- | ChangeLog | 10 | ||||
| -rw-r--r-- | FAQ | 14 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | Makefile.in | 2 | ||||
| -rw-r--r-- | README | 4 | ||||
| -rwxr-xr-x | configure | 2 | ||||
| -rw-r--r-- | crc32.c | 2 | ||||
| -rw-r--r-- | deflate.c | 147 | ||||
| -rw-r--r-- | deflate.h | 10 | ||||
| -rw-r--r-- | gzio.c | 2 | ||||
| -rw-r--r-- | infback.c | 15 | ||||
| -rw-r--r-- | inflate.c | 25 | ||||
| -rw-r--r-- | inflate.h | 7 | ||||
| -rw-r--r-- | inftrees.c | 12 | ||||
| -rw-r--r-- | inftrees.h | 4 | ||||
| -rw-r--r-- | minigzip.c | 2 | ||||
| -rw-r--r-- | qnx/package.qpg | 141 | ||||
| -rw-r--r-- | zlib.3 | 4 | ||||
| -rw-r--r-- | zlib.h | 20 | ||||
| -rw-r--r-- | zutil.c | 2 |
20 files changed, 335 insertions, 92 deletions
| @@ -1,5 +1,15 @@ | |||
| 1 | 1 | ||
| 2 | ChangeLog file for zlib | 2 | ChangeLog file for zlib |
| 3 | Changes in 1.2.0.4 (10 August 2003) | ||
| 4 | - Minor FAQ updates | ||
| 5 | - Be more strict when checking inflateInit2's windowBits parameter | ||
| 6 | - Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well | ||
| 7 | - Add gzip wrapper option to deflateInit2 using windowBits | ||
| 8 | - Add updated QNX rule in configure and qnx directory [Bonnefoy] | ||
| 9 | - Make inflate distance-too-far checks more rigorous | ||
| 10 | - Clean up FAR usage in inflate | ||
| 11 | - Add casting to sizeof() in gzio.c and minigzip.c | ||
| 12 | |||
| 3 | Changes in 1.2.0.3 (19 July 2003) | 13 | Changes in 1.2.0.3 (19 July 2003) |
| 4 | - Fix silly error in gzungetc() implementation [Vollant] | 14 | - Fix silly error in gzungetc() implementation [Vollant] |
| 5 | - Update contrib/minizip and contrib/vstudio [Vollant] | 15 | - Update contrib/minizip and contrib/vstudio [Vollant] |
| @@ -122,8 +122,16 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | |||
| 122 | 122 | ||
| 123 | 18. Well that's nice, but how do I make a gzip file in memory? | 123 | 18. Well that's nice, but how do I make a gzip file in memory? |
| 124 | 124 | ||
| 125 | Read RFC 1952 for the gzip header and trailer format, and roll your own | 125 | You can request that deflate write the gzip format instead of the zlib |
| 126 | gzip formatted data using raw deflate and crc32(). | 126 | format using deflateInit2(). You can also request that inflate decode |
| 127 | the gzip format using inflateInit2(). Read zlib.h for more details. | ||
| 128 | |||
| 129 | Note that you cannot specify special gzip header contents (e.g. a file | ||
| 130 | name or modification date), nor will inflate tell you what was in the | ||
| 131 | gzip header. If you need to customize the header or see what's in it, | ||
| 132 | you can use the raw deflate and inflate operations and the crc32() | ||
| 133 | function and roll your own gzip encoding and decoding. Read the gzip | ||
| 134 | RFC 1952 for details of the header and trailer format. | ||
| 127 | 135 | ||
| 128 | 19. Is zlib thread-safe? | 136 | 19. Is zlib thread-safe? |
| 129 | 137 | ||
| @@ -253,7 +261,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html | |||
| 253 | 32. Is there a Java version of zlib? | 261 | 32. Is there a Java version of zlib? |
| 254 | 262 | ||
| 255 | Probably what you want is to use zlib in Java. zlib is already included | 263 | Probably what you want is to use zlib in Java. zlib is already included |
| 256 | as part of the Java SDK in the java.util.zip class. If you really want | 264 | as part of the Java SDK in the java.util.zip package. If you really want |
| 257 | a version of zlib written in the Java language, look on the zlib home | 265 | a version of zlib written in the Java language, look on the zlib home |
| 258 | page for links: http://www.zlib.org/ | 266 | page for links: http://www.zlib.org/ |
| 259 | 267 | ||
| @@ -24,7 +24,7 @@ LDFLAGS=libz.a | |||
| 24 | LDSHARED=$(CC) | 24 | LDSHARED=$(CC) |
| 25 | CPP=$(CC) -E | 25 | CPP=$(CC) -E |
| 26 | 26 | ||
| 27 | VER=1.2.0.3 | 27 | VER=1.2.0.4 |
| 28 | LIBS=libz.a | 28 | LIBS=libz.a |
| 29 | SHAREDLIB=libz.so | 29 | SHAREDLIB=libz.so |
| 30 | 30 | ||
diff --git a/Makefile.in b/Makefile.in index b1370ef..425ad35 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -24,7 +24,7 @@ LDFLAGS=libz.a | |||
| 24 | LDSHARED=$(CC) | 24 | LDSHARED=$(CC) |
| 25 | CPP=$(CC) -E | 25 | CPP=$(CC) -E |
| 26 | 26 | ||
| 27 | VER=1.2.0.3 | 27 | VER=1.2.0.4 |
| 28 | LIBS=libz.a | 28 | LIBS=libz.a |
| 29 | SHAREDLIB=libz.so | 29 | SHAREDLIB=libz.so |
| 30 | 30 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | ZLIB DATA COMPRESSION LIBRARY | 1 | ZLIB DATA COMPRESSION LIBRARY |
| 2 | 2 | ||
| 3 | zlib 1.2.0.3 is a general purpose data compression library. All the code is | 3 | zlib 1.2.0.4 is a general purpose data compression library. All the code is |
| 4 | thread safe. The data format used by the zlib library is described by RFCs | 4 | thread safe. The data format used by the zlib library is described by RFCs |
| 5 | (Request for Comments) 1950 to 1952 in the files | 5 | (Request for Comments) 1950 to 1952 in the files |
| 6 | http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) | 6 | http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) |
| @@ -34,7 +34,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997 | |||
| 34 | issue of Dr. Dobb's Journal; a copy of the article is available in | 34 | issue of Dr. Dobb's Journal; a copy of the article is available in |
| 35 | http://dogma.net/markn/articles/zlibtool/zlibtool.htm | 35 | http://dogma.net/markn/articles/zlibtool/zlibtool.htm |
| 36 | 36 | ||
| 37 | The changes made in version 1.2.0.3 are documented in the file ChangeLog. | 37 | The changes made in version 1.2.0.4 are documented in the file ChangeLog. |
| 38 | 38 | ||
| 39 | Unsupported third party contributions are provided in directory "contrib". | 39 | Unsupported third party contributions are provided in directory "contrib". |
| 40 | 40 | ||
| @@ -78,6 +78,8 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then | |||
| 78 | CFLAGS="$cflags" | 78 | CFLAGS="$cflags" |
| 79 | case `(uname -s || echo unknown) 2>/dev/null` in | 79 | case `(uname -s || echo unknown) 2>/dev/null` in |
| 80 | Linux | linux) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; | 80 | Linux | linux) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; |
| 81 | QNX*) #This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 (alain.bonnefoy@icbt.com) | ||
| 82 | LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};; | ||
| 81 | HP-UX*) LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} | 83 | HP-UX*) LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} |
| 82 | shared_ext='.sl' | 84 | shared_ext='.sl' |
| 83 | SHAREDLIB='libz.sl';; | 85 | SHAREDLIB='libz.sl';; |
| @@ -18,7 +18,7 @@ | |||
| 18 | # endif /* !DYNAMIC_CRC_TABLE */ | 18 | # endif /* !DYNAMIC_CRC_TABLE */ |
| 19 | #endif /* MAKECRCH */ | 19 | #endif /* MAKECRCH */ |
| 20 | 20 | ||
| 21 | #include "zutil.h" | 21 | #include "zutil.h" /* for STDC and FAR definitions */ |
| 22 | 22 | ||
| 23 | #define local static | 23 | #define local static |
| 24 | 24 | ||
| @@ -52,7 +52,7 @@ | |||
| 52 | #include "deflate.h" | 52 | #include "deflate.h" |
| 53 | 53 | ||
| 54 | const char deflate_copyright[] = | 54 | const char deflate_copyright[] = |
| 55 | " deflate 1.2.0.3 Copyright 1995-2003 Jean-loup Gailly "; | 55 | " deflate 1.2.0.4 Copyright 1995-2003 Jean-loup Gailly "; |
| 56 | /* | 56 | /* |
| 57 | If you use the zlib library in a product, an acknowledgment is welcome | 57 | If you use the zlib library in a product, an acknowledgment is welcome |
| 58 | in the documentation of your product. If for some reason you cannot | 58 | in the documentation of your product. If for some reason you cannot |
| @@ -132,12 +132,12 @@ typedef struct config_s { | |||
| 132 | local const config configuration_table[2] = { | 132 | local const config configuration_table[2] = { |
| 133 | /* good lazy nice chain */ | 133 | /* good lazy nice chain */ |
| 134 | /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ | 134 | /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ |
| 135 | /* 1 */ {4, 4, 8, 4, deflate_fast}}; /* maximum speed, no lazy matches */ | 135 | /* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ |
| 136 | #else | 136 | #else |
| 137 | local const config configuration_table[10] = { | 137 | local const config configuration_table[10] = { |
| 138 | /* good lazy nice chain */ | 138 | /* good lazy nice chain */ |
| 139 | /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ | 139 | /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ |
| 140 | /* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */ | 140 | /* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ |
| 141 | /* 2 */ {4, 5, 16, 8, deflate_fast}, | 141 | /* 2 */ {4, 5, 16, 8, deflate_fast}, |
| 142 | /* 3 */ {4, 6, 32, 32, deflate_fast}, | 142 | /* 3 */ {4, 6, 32, 32, deflate_fast}, |
| 143 | 143 | ||
| @@ -146,7 +146,7 @@ local const config configuration_table[10] = { | |||
| 146 | /* 6 */ {8, 16, 128, 128, deflate_slow}, | 146 | /* 6 */ {8, 16, 128, 128, deflate_slow}, |
| 147 | /* 7 */ {8, 32, 128, 256, deflate_slow}, | 147 | /* 7 */ {8, 32, 128, 256, deflate_slow}, |
| 148 | /* 8 */ {32, 128, 258, 1024, deflate_slow}, | 148 | /* 8 */ {32, 128, 258, 1024, deflate_slow}, |
| 149 | /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */ | 149 | /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ |
| 150 | #endif | 150 | #endif |
| 151 | 151 | ||
| 152 | /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 | 152 | /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 |
| @@ -225,7 +225,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
| 225 | int stream_size; | 225 | int stream_size; |
| 226 | { | 226 | { |
| 227 | deflate_state *s; | 227 | deflate_state *s; |
| 228 | int noheader = 0; | 228 | int wrap = 1; |
| 229 | static const char my_version[] = ZLIB_VERSION; | 229 | static const char my_version[] = ZLIB_VERSION; |
| 230 | 230 | ||
| 231 | ushf *overlay; | 231 | ushf *overlay; |
| @@ -252,10 +252,16 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
| 252 | if (level == Z_DEFAULT_COMPRESSION) level = 6; | 252 | if (level == Z_DEFAULT_COMPRESSION) level = 6; |
| 253 | #endif | 253 | #endif |
| 254 | 254 | ||
| 255 | if (windowBits < 0) { /* undocumented feature: suppress zlib header */ | 255 | if (windowBits < 0) { /* suppress zlib wrapper */ |
| 256 | noheader = 1; | 256 | wrap = 0; |
| 257 | windowBits = -windowBits; | 257 | windowBits = -windowBits; |
| 258 | } | 258 | } |
| 259 | #ifdef GZIP | ||
| 260 | else if (windowBits > 15) { | ||
| 261 | wrap = 2; /* write gzip wrapper instead */ | ||
| 262 | windowBits -= 16; | ||
| 263 | } | ||
| 264 | #endif | ||
| 259 | if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || | 265 | if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || |
| 260 | windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || | 266 | windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || |
| 261 | strategy < 0 || strategy > Z_RLE) { | 267 | strategy < 0 || strategy > Z_RLE) { |
| @@ -267,7 +273,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
| 267 | strm->state = (struct internal_state FAR *)s; | 273 | strm->state = (struct internal_state FAR *)s; |
| 268 | s->strm = strm; | 274 | s->strm = strm; |
| 269 | 275 | ||
| 270 | s->noheader = noheader; | 276 | s->wrap = wrap; |
| 271 | s->w_bits = windowBits; | 277 | s->w_bits = windowBits; |
| 272 | s->w_size = 1 << s->w_bits; | 278 | s->w_size = 1 << s->w_bits; |
| 273 | s->w_mask = s->w_size - 1; | 279 | s->w_mask = s->w_size - 1; |
| @@ -316,11 +322,12 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) | |||
| 316 | IPos hash_head = 0; | 322 | IPos hash_head = 0; |
| 317 | 323 | ||
| 318 | if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || | 324 | if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || |
| 319 | (!strm->state->noheader && strm->state->status != INIT_STATE)) | 325 | strm->state->wrap == 2 || |
| 326 | (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) | ||
| 320 | return Z_STREAM_ERROR; | 327 | return Z_STREAM_ERROR; |
| 321 | 328 | ||
| 322 | s = strm->state; | 329 | s = strm->state; |
| 323 | if (!s->noheader) | 330 | if (s->wrap) |
| 324 | strm->adler = adler32(strm->adler, dictionary, dictLength); | 331 | strm->adler = adler32(strm->adler, dictionary, dictLength); |
| 325 | 332 | ||
| 326 | if (length < MIN_MATCH) return Z_OK; | 333 | if (length < MIN_MATCH) return Z_OK; |
| @@ -364,11 +371,15 @@ int ZEXPORT deflateReset (strm) | |||
| 364 | s->pending = 0; | 371 | s->pending = 0; |
| 365 | s->pending_out = s->pending_buf; | 372 | s->pending_out = s->pending_buf; |
| 366 | 373 | ||
| 367 | if (s->noheader < 0) { | 374 | if (s->wrap < 0) { |
| 368 | s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */ | 375 | s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ |
| 369 | } | 376 | } |
| 370 | s->status = s->noheader ? BUSY_STATE : INIT_STATE; | 377 | s->status = s->wrap ? INIT_STATE : BUSY_STATE; |
| 371 | strm->adler = 1; | 378 | strm->adler = |
| 379 | #ifdef GZIP | ||
| 380 | s->wrap == 2 ? crc32(0L, Z_NULL, 0) : | ||
| 381 | #endif | ||
| 382 | adler32(0L, Z_NULL, 0); | ||
| 372 | s->last_flush = Z_NO_FLUSH; | 383 | s->last_flush = Z_NO_FLUSH; |
| 373 | 384 | ||
| 374 | _tr_init(s); | 385 | _tr_init(s); |
| @@ -428,7 +439,7 @@ int ZEXPORT deflateParams(strm, level, strategy) | |||
| 428 | * can emit on compressed data for some combinations of the parameters. | 439 | * can emit on compressed data for some combinations of the parameters. |
| 429 | * | 440 | * |
| 430 | * This function could be more sophisticated to provide closer upper bounds | 441 | * This function could be more sophisticated to provide closer upper bounds |
| 431 | * for every combination of windowBits and memLevel, as well as noheader. | 442 | * for every combination of windowBits and memLevel, as well as wrap. |
| 432 | * But even the conservative upper bound of about 14% expansion does not | 443 | * But even the conservative upper bound of about 14% expansion does not |
| 433 | * seem onerous for output buffer allocation. | 444 | * seem onerous for output buffer allocation. |
| 434 | */ | 445 | */ |
| @@ -519,33 +530,53 @@ int ZEXPORT deflate (strm, flush) | |||
| 519 | old_flush = s->last_flush; | 530 | old_flush = s->last_flush; |
| 520 | s->last_flush = flush; | 531 | s->last_flush = flush; |
| 521 | 532 | ||
| 522 | /* Write the zlib header */ | 533 | /* Write the header */ |
| 523 | if (s->status == INIT_STATE) { | 534 | if (s->status == INIT_STATE) { |
| 524 | 535 | #ifdef GZIP | |
| 525 | uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; | 536 | if (s->wrap == 2) { |
| 526 | uInt level_flags; | 537 | put_byte(s, 31); |
| 527 | 538 | put_byte(s, 139); | |
| 528 | if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) | 539 | put_byte(s, 8); |
| 529 | level_flags = 0; | 540 | put_byte(s, 0); |
| 530 | else if (s->level < 6) | 541 | put_byte(s, 0); |
| 531 | level_flags = 1; | 542 | put_byte(s, 0); |
| 532 | else if (s->level == 6) | 543 | put_byte(s, 0); |
| 533 | level_flags = 2; | 544 | put_byte(s, 0); |
| 545 | put_byte(s, s->level == 9 ? 2 : | ||
| 546 | (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? | ||
| 547 | 4 : 0)); | ||
| 548 | put_byte(s, 255); | ||
| 549 | s->status = BUSY_STATE; | ||
| 550 | strm->adler = crc32(0L, Z_NULL, 0); | ||
| 551 | } | ||
| 534 | else | 552 | else |
| 535 | level_flags = 3; | 553 | #endif |
| 536 | header |= (level_flags << 6); | 554 | { |
| 537 | if (s->strstart != 0) header |= PRESET_DICT; | 555 | uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; |
| 538 | header += 31 - (header % 31); | 556 | uInt level_flags; |
| 539 | 557 | ||
| 540 | s->status = BUSY_STATE; | 558 | if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) |
| 541 | putShortMSB(s, header); | 559 | level_flags = 0; |
| 542 | 560 | else if (s->level < 6) | |
| 543 | /* Save the adler32 of the preset dictionary: */ | 561 | level_flags = 1; |
| 544 | if (s->strstart != 0) { | 562 | else if (s->level == 6) |
| 545 | putShortMSB(s, (uInt)(strm->adler >> 16)); | 563 | level_flags = 2; |
| 546 | putShortMSB(s, (uInt)(strm->adler & 0xffff)); | 564 | else |
| 565 | level_flags = 3; | ||
| 566 | header |= (level_flags << 6); | ||
| 567 | if (s->strstart != 0) header |= PRESET_DICT; | ||
| 568 | header += 31 - (header % 31); | ||
| 569 | |||
| 570 | s->status = BUSY_STATE; | ||
| 571 | putShortMSB(s, header); | ||
| 572 | |||
| 573 | /* Save the adler32 of the preset dictionary: */ | ||
| 574 | if (s->strstart != 0) { | ||
| 575 | putShortMSB(s, (uInt)(strm->adler >> 16)); | ||
| 576 | putShortMSB(s, (uInt)(strm->adler & 0xffff)); | ||
| 577 | } | ||
| 578 | strm->adler = adler32(0L, Z_NULL, 0); | ||
| 547 | } | 579 | } |
| 548 | strm->adler = 1L; | ||
| 549 | } | 580 | } |
| 550 | 581 | ||
| 551 | /* Flush as much pending output as possible */ | 582 | /* Flush as much pending output as possible */ |
| @@ -622,16 +653,31 @@ int ZEXPORT deflate (strm, flush) | |||
| 622 | Assert(strm->avail_out > 0, "bug2"); | 653 | Assert(strm->avail_out > 0, "bug2"); |
| 623 | 654 | ||
| 624 | if (flush != Z_FINISH) return Z_OK; | 655 | if (flush != Z_FINISH) return Z_OK; |
| 625 | if (s->noheader) return Z_STREAM_END; | 656 | if (s->wrap <= 0) return Z_STREAM_END; |
| 626 | 657 | ||
| 627 | /* Write the zlib trailer (adler32) */ | 658 | /* Write the trailer */ |
| 628 | putShortMSB(s, (uInt)(strm->adler >> 16)); | 659 | #ifdef GZIP |
| 629 | putShortMSB(s, (uInt)(strm->adler & 0xffff)); | 660 | if (s->wrap == 2) { |
| 661 | put_byte(s, (Byte)(strm->adler & 0xff)); | ||
| 662 | put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); | ||
| 663 | put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); | ||
| 664 | put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); | ||
| 665 | put_byte(s, (Byte)(strm->total_in & 0xff)); | ||
| 666 | put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); | ||
| 667 | put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); | ||
| 668 | put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); | ||
| 669 | } | ||
| 670 | else | ||
| 671 | #endif | ||
| 672 | { | ||
| 673 | putShortMSB(s, (uInt)(strm->adler >> 16)); | ||
| 674 | putShortMSB(s, (uInt)(strm->adler & 0xffff)); | ||
| 675 | } | ||
| 630 | flush_pending(strm); | 676 | flush_pending(strm); |
| 631 | /* If avail_out is zero, the application will call deflate again | 677 | /* If avail_out is zero, the application will call deflate again |
| 632 | * to flush the rest. | 678 | * to flush the rest. |
| 633 | */ | 679 | */ |
| 634 | s->noheader = -1; /* write the trailer only once! */ | 680 | if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ |
| 635 | return s->pending != 0 ? Z_OK : Z_STREAM_END; | 681 | return s->pending != 0 ? Z_OK : Z_STREAM_END; |
| 636 | } | 682 | } |
| 637 | 683 | ||
| @@ -740,9 +786,14 @@ local int read_buf(strm, buf, size) | |||
| 740 | 786 | ||
| 741 | strm->avail_in -= len; | 787 | strm->avail_in -= len; |
| 742 | 788 | ||
| 743 | if (!strm->state->noheader) { | 789 | if (strm->state->wrap == 1) { |
| 744 | strm->adler = adler32(strm->adler, strm->next_in, len); | 790 | strm->adler = adler32(strm->adler, strm->next_in, len); |
| 745 | } | 791 | } |
| 792 | #ifdef GZIP | ||
| 793 | else if (strm->state->wrap == 2) { | ||
| 794 | strm->adler = crc32(strm->adler, strm->next_in, len); | ||
| 795 | } | ||
| 796 | #endif | ||
| 746 | zmemcpy(buf, strm->next_in, len); | 797 | zmemcpy(buf, strm->next_in, len); |
| 747 | strm->next_in += len; | 798 | strm->next_in += len; |
| 748 | strm->total_in += len; | 799 | strm->total_in += len; |
| @@ -1044,7 +1095,7 @@ local void fill_window(s) | |||
| 1044 | 1095 | ||
| 1045 | } else if (more == (unsigned)(-1)) { | 1096 | } else if (more == (unsigned)(-1)) { |
| 1046 | /* Very unlikely, but possible on 16 bit machine if | 1097 | /* Very unlikely, but possible on 16 bit machine if |
| 1047 | * strstart == 0 && lookahead == 1 (input done one byte at time) | 1098 | * strstart == 0 && lookahead == 1 (input done a byte at time) |
| 1048 | */ | 1099 | */ |
| 1049 | more--; | 1100 | more--; |
| 1050 | } | 1101 | } |
| @@ -1271,7 +1322,7 @@ local block_state deflate_fast(s, flush) | |||
| 1271 | #ifndef FASTEST | 1322 | #ifndef FASTEST |
| 1272 | if (s->match_length <= s->max_insert_length && | 1323 | if (s->match_length <= s->max_insert_length && |
| 1273 | s->lookahead >= MIN_MATCH) { | 1324 | s->lookahead >= MIN_MATCH) { |
| 1274 | s->match_length--; /* string at strstart already in hash table */ | 1325 | s->match_length--; /* string at strstart already in table */ |
| 1275 | do { | 1326 | do { |
| 1276 | s->strstart++; | 1327 | s->strstart++; |
| 1277 | INSERT_STRING(s, s->strstart, hash_head); | 1328 | INSERT_STRING(s, s->strstart, hash_head); |
| @@ -15,6 +15,14 @@ | |||
| 15 | 15 | ||
| 16 | #include "zutil.h" | 16 | #include "zutil.h" |
| 17 | 17 | ||
| 18 | /* define NO_GZIP when compiling if you want to disable gzip header and | ||
| 19 | trailer creation by deflate(). NO_GZIP would be used to avoid linking in | ||
| 20 | the crc code when it is not needed. For shared libraries, gzip encoding | ||
| 21 | should be left enabled. */ | ||
| 22 | #ifndef NO_GZIP | ||
| 23 | # define GZIP | ||
| 24 | #endif | ||
| 25 | |||
| 18 | /* =========================================================================== | 26 | /* =========================================================================== |
| 19 | * Internal compression state. | 27 | * Internal compression state. |
| 20 | */ | 28 | */ |
| @@ -86,7 +94,7 @@ typedef struct internal_state { | |||
| 86 | ulg pending_buf_size; /* size of pending_buf */ | 94 | ulg pending_buf_size; /* size of pending_buf */ |
| 87 | Bytef *pending_out; /* next pending byte to output to the stream */ | 95 | Bytef *pending_out; /* next pending byte to output to the stream */ |
| 88 | int pending; /* nb of bytes in the pending buffer */ | 96 | int pending; /* nb of bytes in the pending buffer */ |
| 89 | int noheader; /* suppress zlib header and adler32 */ | 97 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ |
| 90 | Byte data_type; /* UNKNOWN, BINARY or ASCII */ | 98 | Byte data_type; /* UNKNOWN, BINARY or ASCII */ |
| 91 | Byte method; /* STORED (for zip only) or DEFLATED */ | 99 | Byte method; /* STORED (for zip only) or DEFLATED */ |
| 92 | int last_flush; /* value of flush param for previous deflate call */ | 100 | int last_flush; /* value of flush param for previous deflate call */ |
| @@ -608,7 +608,7 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) | |||
| 608 | va_end(va); | 608 | va_end(va); |
| 609 | # endif | 609 | # endif |
| 610 | #endif | 610 | #endif |
| 611 | if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) | 611 | if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) |
| 612 | return 0; | 612 | return 0; |
| 613 | return gzwrite(file, buf, (unsigned)len); | 613 | return gzwrite(file, buf, (unsigned)len); |
| 614 | } | 614 | } |
| @@ -55,6 +55,7 @@ int stream_size; | |||
| 55 | state->wsize = 1U << windowBits; | 55 | state->wsize = 1U << windowBits; |
| 56 | state->window = window; | 56 | state->window = window; |
| 57 | state->write = 0; | 57 | state->write = 0; |
| 58 | state->whave = 0; | ||
| 58 | return Z_OK; | 59 | return Z_OK; |
| 59 | } | 60 | } |
| 60 | 61 | ||
| @@ -201,6 +202,7 @@ struct inflate_state FAR *state; | |||
| 201 | if (left == 0) { \ | 202 | if (left == 0) { \ |
| 202 | put = state->window; \ | 203 | put = state->window; \ |
| 203 | left = state->wsize; \ | 204 | left = state->wsize; \ |
| 205 | state->whave = left; \ | ||
| 204 | if (out(out_desc, put, left)) { \ | 206 | if (out(out_desc, put, left)) { \ |
| 205 | ret = Z_BUF_ERROR; \ | 207 | ret = Z_BUF_ERROR; \ |
| 206 | goto inf_leave; \ | 208 | goto inf_leave; \ |
| @@ -216,7 +218,7 @@ struct inflate_state FAR *state; | |||
| 216 | in() and out() are the call-back input and output functions. When | 218 | in() and out() are the call-back input and output functions. When |
| 217 | inflateBack() needs more input, it calls in(). When inflateBack() has | 219 | inflateBack() needs more input, it calls in(). When inflateBack() has |
| 218 | filled the window with output, or when it completes with data in the | 220 | filled the window with output, or when it completes with data in the |
| 219 | window, it called out() to write out the data. The application must not | 221 | window, it calls out() to write out the data. The application must not |
| 220 | change the provided input until in() is called again or inflateBack() | 222 | change the provided input until in() is called again or inflateBack() |
| 221 | returns. The application must not change the window/output buffer until | 223 | returns. The application must not change the window/output buffer until |
| 222 | inflateBack() returns. | 224 | inflateBack() returns. |
| @@ -243,12 +245,13 @@ out_func out; | |||
| 243 | void FAR *out_desc; | 245 | void FAR *out_desc; |
| 244 | { | 246 | { |
| 245 | struct inflate_state FAR *state; | 247 | struct inflate_state FAR *state; |
| 246 | unsigned char *next, *put; /* next input and output */ | 248 | unsigned char FAR *next; /* next input */ |
| 249 | unsigned char FAR *put; /* next output */ | ||
| 247 | unsigned have, left; /* available input and output */ | 250 | unsigned have, left; /* available input and output */ |
| 248 | unsigned long hold; /* bit buffer */ | 251 | unsigned long hold; /* bit buffer */ |
| 249 | unsigned bits; /* bits in bit buffer */ | 252 | unsigned bits; /* bits in bit buffer */ |
| 250 | unsigned copy; /* number of stored or match bytes to copy */ | 253 | unsigned copy; /* number of stored or match bytes to copy */ |
| 251 | unsigned char *from; /* where to copy match bytes from */ | 254 | unsigned char FAR *from; /* where to copy match bytes from */ |
| 252 | code this; /* current decoding table entry */ | 255 | code this; /* current decoding table entry */ |
| 253 | code last; /* parent table entry */ | 256 | code last; /* parent table entry */ |
| 254 | unsigned len; /* length to copy for repeats, bits to drop */ | 257 | unsigned len; /* length to copy for repeats, bits to drop */ |
| @@ -265,6 +268,7 @@ void FAR *out_desc; | |||
| 265 | strm->msg = Z_NULL; | 268 | strm->msg = Z_NULL; |
| 266 | state->mode = TYPE; | 269 | state->mode = TYPE; |
| 267 | state->last = 0; | 270 | state->last = 0; |
| 271 | state->whave = 0; | ||
| 268 | next = strm->next_in; | 272 | next = strm->next_in; |
| 269 | have = next != Z_NULL ? strm->avail_in : 0; | 273 | have = next != Z_NULL ? strm->avail_in : 0; |
| 270 | hold = 0; | 274 | hold = 0; |
| @@ -457,6 +461,8 @@ void FAR *out_desc; | |||
| 457 | /* use inflate_fast() if we have enough input and output */ | 461 | /* use inflate_fast() if we have enough input and output */ |
| 458 | if (have >= 6 && left >= 258) { | 462 | if (have >= 6 && left >= 258) { |
| 459 | RESTORE(); | 463 | RESTORE(); |
| 464 | if (state->whave < state->wsize) | ||
| 465 | state->whave = state->wsize - left; | ||
| 460 | inflate_fast(strm, state->wsize); | 466 | inflate_fast(strm, state->wsize); |
| 461 | LOAD(); | 467 | LOAD(); |
| 462 | break; | 468 | break; |
| @@ -547,7 +553,8 @@ void FAR *out_desc; | |||
| 547 | state->offset += BITS(state->extra); | 553 | state->offset += BITS(state->extra); |
| 548 | DROPBITS(state->extra); | 554 | DROPBITS(state->extra); |
| 549 | } | 555 | } |
| 550 | if (state->offset > state->wsize) { | 556 | if (state->offset > state->wsize - (state->whave < state->wsize ? |
| 557 | left : 0)) { | ||
| 551 | strm->msg = (char *)"invalid distance too far back"; | 558 | strm->msg = (char *)"invalid distance too far back"; |
| 552 | state->mode = BAD; | 559 | state->mode = BAD; |
| 553 | break; | 560 | break; |
| @@ -113,6 +113,7 @@ z_streamp strm; | |||
| 113 | state->last = 0; | 113 | state->last = 0; |
| 114 | state->havedict = 0; | 114 | state->havedict = 0; |
| 115 | state->wsize = 0; | 115 | state->wsize = 0; |
| 116 | state->whave = 0; | ||
| 116 | state->hold = 0; | 117 | state->hold = 0; |
| 117 | state->bits = 0; | 118 | state->bits = 0; |
| 118 | state->lencode = state->distcode = state->next = state->codes; | 119 | state->lencode = state->distcode = state->next = state->codes; |
| @@ -150,7 +151,7 @@ int stream_size; | |||
| 150 | else { | 151 | else { |
| 151 | state->wrap = (windowBits >> 4) + 1; | 152 | state->wrap = (windowBits >> 4) + 1; |
| 152 | #ifdef GUNZIP | 153 | #ifdef GUNZIP |
| 153 | windowBits &= 15; | 154 | if (windowBits < 48) windowBits &= 15; |
| 154 | #endif | 155 | #endif |
| 155 | } | 156 | } |
| 156 | if (windowBits < 8 || windowBits > 15) { | 157 | if (windowBits < 8 || windowBits > 15) { |
| @@ -320,6 +321,7 @@ unsigned out; | |||
| 320 | if (state->wsize == 0) { | 321 | if (state->wsize == 0) { |
| 321 | state->wsize = 1U << state->wbits; | 322 | state->wsize = 1U << state->wbits; |
| 322 | state->write = 0; | 323 | state->write = 0; |
| 324 | state->whave = 0; | ||
| 323 | } | 325 | } |
| 324 | 326 | ||
| 325 | /* copy state->wsize or less output bytes into the circular window */ | 327 | /* copy state->wsize or less output bytes into the circular window */ |
| @@ -327,6 +329,7 @@ unsigned out; | |||
| 327 | if (copy >= state->wsize) { | 329 | if (copy >= state->wsize) { |
| 328 | zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); | 330 | zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); |
| 329 | state->write = 0; | 331 | state->write = 0; |
| 332 | state->whave = state->wsize; | ||
| 330 | } | 333 | } |
| 331 | else { | 334 | else { |
| 332 | dist = state->wsize - state->write; | 335 | dist = state->wsize - state->write; |
| @@ -336,10 +339,12 @@ unsigned out; | |||
| 336 | if (copy) { | 339 | if (copy) { |
| 337 | zmemcpy(state->window, strm->next_out - copy, copy); | 340 | zmemcpy(state->window, strm->next_out - copy, copy); |
| 338 | state->write = copy; | 341 | state->write = copy; |
| 342 | state->whave = state->wsize; | ||
| 339 | } | 343 | } |
| 340 | else { | 344 | else { |
| 341 | state->write += dist; | 345 | state->write += dist; |
| 342 | if (state->write == state->wsize) state->write = 0; | 346 | if (state->write == state->wsize) state->write = 0; |
| 347 | if (state->whave < state->wsize) state->whave += dist; | ||
| 343 | } | 348 | } |
| 344 | } | 349 | } |
| 345 | return 0; | 350 | return 0; |
| @@ -531,13 +536,14 @@ z_streamp strm; | |||
| 531 | int flush; | 536 | int flush; |
| 532 | { | 537 | { |
| 533 | struct inflate_state FAR *state; | 538 | struct inflate_state FAR *state; |
| 534 | unsigned char *next, *put; /* next input and output */ | 539 | unsigned char FAR *next; /* next input */ |
| 540 | unsigned char FAR *put; /* next output */ | ||
| 535 | unsigned have, left; /* available input and output */ | 541 | unsigned have, left; /* available input and output */ |
| 536 | unsigned long hold; /* bit buffer */ | 542 | unsigned long hold; /* bit buffer */ |
| 537 | unsigned bits; /* bits in bit buffer */ | 543 | unsigned bits; /* bits in bit buffer */ |
| 538 | unsigned in, out; /* save starting available input and output */ | 544 | unsigned in, out; /* save starting available input and output */ |
| 539 | unsigned copy; /* number of stored or match bytes to copy */ | 545 | unsigned copy; /* number of stored or match bytes to copy */ |
| 540 | unsigned char *from; /* where to copy match bytes from */ | 546 | unsigned char FAR *from; /* where to copy match bytes from */ |
| 541 | code this; /* current decoding table entry */ | 547 | code this; /* current decoding table entry */ |
| 542 | code last; /* parent table entry */ | 548 | code last; /* parent table entry */ |
| 543 | unsigned len; /* length to copy for repeats, bits to drop */ | 549 | unsigned len; /* length to copy for repeats, bits to drop */ |
| @@ -956,8 +962,7 @@ int flush; | |||
| 956 | state->offset += BITS(state->extra); | 962 | state->offset += BITS(state->extra); |
| 957 | DROPBITS(state->extra); | 963 | DROPBITS(state->extra); |
| 958 | } | 964 | } |
| 959 | if (state->offset > (state->wsize ? state->wsize : | 965 | if (state->offset > state->whave + out - left) { |
| 960 | out - left)) { | ||
| 961 | strm->msg = (char *)"invalid distance too far back"; | 966 | strm->msg = (char *)"invalid distance too far back"; |
| 962 | state->mode = BAD; | 967 | state->mode = BAD; |
| 963 | break; | 968 | break; |
| @@ -1108,12 +1113,16 @@ uInt dictLength; | |||
| 1108 | state->mode = MEM; | 1113 | state->mode = MEM; |
| 1109 | return Z_MEM_ERROR; | 1114 | return Z_MEM_ERROR; |
| 1110 | } | 1115 | } |
| 1111 | if (dictLength > state->wsize) | 1116 | if (dictLength > state->wsize) { |
| 1112 | zmemcpy(state->window, dictionary + dictLength - state->wsize, | 1117 | zmemcpy(state->window, dictionary + dictLength - state->wsize, |
| 1113 | state->wsize); | 1118 | state->wsize); |
| 1114 | else | 1119 | state->whave = state->wsize; |
| 1120 | } | ||
| 1121 | else { | ||
| 1115 | zmemcpy(state->window + state->wsize - dictLength, dictionary, | 1122 | zmemcpy(state->window + state->wsize - dictLength, dictionary, |
| 1116 | dictLength); | 1123 | dictLength); |
| 1124 | state->whave = dictLength; | ||
| 1125 | } | ||
| 1117 | state->havedict = 1; | 1126 | state->havedict = 1; |
| 1118 | Tracev((stderr, "inflate: dictionary set\n")); | 1127 | Tracev((stderr, "inflate: dictionary set\n")); |
| 1119 | return Z_OK; | 1128 | return Z_OK; |
| @@ -1131,7 +1140,7 @@ uInt dictLength; | |||
| 1131 | zero for the first call. | 1140 | zero for the first call. |
| 1132 | */ | 1141 | */ |
| 1133 | local unsigned syncsearch(have, buf, len) | 1142 | local unsigned syncsearch(have, buf, len) |
| 1134 | unsigned *have; | 1143 | unsigned FAR *have; |
| 1135 | unsigned char FAR *buf; | 1144 | unsigned char FAR *buf; |
| 1136 | unsigned len; | 1145 | unsigned len; |
| 1137 | { | 1146 | { |
| @@ -8,11 +8,11 @@ | |||
| 8 | subject to change. Applications should only use zlib.h. | 8 | subject to change. Applications should only use zlib.h. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | /* define NO_GUNZIP when compiling if you want to disable gzip header and | 11 | /* define NO_GZIP when compiling if you want to disable gzip header and |
| 12 | trailer decoding by inflate(). NO_GUNZIP would be used to avoid linking in | 12 | trailer decoding by inflate(). NO_GZIP would be used to avoid linking in |
| 13 | the crc code when it is not needed. For shared libraries, gzip decoding | 13 | the crc code when it is not needed. For shared libraries, gzip decoding |
| 14 | should be left enabled. */ | 14 | should be left enabled. */ |
| 15 | #ifndef NO_GUNZIP | 15 | #ifndef NO_GZIP |
| 16 | # define GUNZIP | 16 | # define GUNZIP |
| 17 | #endif | 17 | #endif |
| 18 | 18 | ||
| @@ -88,6 +88,7 @@ struct inflate_state { | |||
| 88 | /* sliding window */ | 88 | /* sliding window */ |
| 89 | unsigned wbits; /* log base 2 of requested window size */ | 89 | unsigned wbits; /* log base 2 of requested window size */ |
| 90 | unsigned wsize; /* window size or zero if not using window */ | 90 | unsigned wsize; /* window size or zero if not using window */ |
| 91 | unsigned whave; /* valid bytes in the window */ | ||
| 91 | unsigned write; /* window write index */ | 92 | unsigned write; /* window write index */ |
| 92 | unsigned char FAR *window; /* allocated sliding window, if needed */ | 93 | unsigned char FAR *window; /* allocated sliding window, if needed */ |
| 93 | /* bit accumulator */ | 94 | /* bit accumulator */ |
| @@ -9,7 +9,7 @@ | |||
| 9 | #define MAXBITS 15 | 9 | #define MAXBITS 15 |
| 10 | 10 | ||
| 11 | const char inflate_copyright[] = | 11 | const char inflate_copyright[] = |
| 12 | " inflate 1.2.0.3 Copyright 1995-2003 Mark Adler "; | 12 | " inflate 1.2.0.4 Copyright 1995-2003 Mark Adler "; |
| 13 | /* | 13 | /* |
| 14 | If you use the zlib library in a product, an acknowledgment is welcome | 14 | If you use the zlib library in a product, an acknowledgment is welcome |
| 15 | in the documentation of your product. If for some reason you cannot | 15 | in the documentation of your product. If for some reason you cannot |
| @@ -33,8 +33,8 @@ int inflate_table(type, lens, codes, table, bits, work) | |||
| 33 | codetype type; | 33 | codetype type; |
| 34 | unsigned short FAR *lens; | 34 | unsigned short FAR *lens; |
| 35 | unsigned codes; | 35 | unsigned codes; |
| 36 | code * FAR *table; | 36 | code FAR * FAR *table; |
| 37 | unsigned *bits; | 37 | unsigned FAR *bits; |
| 38 | unsigned short FAR *work; | 38 | unsigned short FAR *work; |
| 39 | { | 39 | { |
| 40 | unsigned len; /* a code's length in bits */ | 40 | unsigned len; /* a code's length in bits */ |
| @@ -52,8 +52,8 @@ unsigned short FAR *work; | |||
| 52 | unsigned mask; /* mask for low root bits */ | 52 | unsigned mask; /* mask for low root bits */ |
| 53 | code this; /* table entry for duplication */ | 53 | code this; /* table entry for duplication */ |
| 54 | code FAR *next; /* next available space in table */ | 54 | code FAR *next; /* next available space in table */ |
| 55 | const unsigned short *base; /* base value table to use */ | 55 | const unsigned short FAR *base; /* base value table to use */ |
| 56 | const unsigned short *extra; /* extra bits table to use */ | 56 | const unsigned short FAR *extra; /* extra bits table to use */ |
| 57 | int end; /* use base and extra for symbol > end */ | 57 | int end; /* use base and extra for symbol > end */ |
| 58 | unsigned short count[MAXBITS+1]; /* number of codes of each length */ | 58 | unsigned short count[MAXBITS+1]; /* number of codes of each length */ |
| 59 | unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ | 59 | unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ |
| @@ -62,7 +62,7 @@ unsigned short FAR *work; | |||
| 62 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; | 62 | 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; |
| 63 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ | 63 | static const unsigned short lext[31] = { /* Length codes 257..285 extra */ |
| 64 | 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, | 64 | 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, |
| 65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 193, 193}; | 65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 192}; |
| 66 | static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ | 66 | static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ |
| 67 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, | 67 | 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, |
| 68 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, | 68 | 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, |
| @@ -51,5 +51,5 @@ typedef enum { | |||
| 51 | } codetype; | 51 | } codetype; |
| 52 | 52 | ||
| 53 | extern int inflate_table OF((codetype type, unsigned short FAR *lens, | 53 | extern int inflate_table OF((codetype type, unsigned short FAR *lens, |
| 54 | unsigned codes, code * FAR *table, unsigned *bits, | 54 | unsigned codes, code FAR * FAR *table, |
| 55 | unsigned short FAR *work)); | 55 | unsigned FAR *bits, unsigned short FAR *work)); |
| @@ -60,7 +60,7 @@ | |||
| 60 | #ifndef GZ_SUFFIX | 60 | #ifndef GZ_SUFFIX |
| 61 | # define GZ_SUFFIX ".gz" | 61 | # define GZ_SUFFIX ".gz" |
| 62 | #endif | 62 | #endif |
| 63 | #define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) | 63 | #define SUFFIX_LEN ((int)sizeof(GZ_SUFFIX)-1) |
| 64 | 64 | ||
| 65 | #define BUFLEN 16384 | 65 | #define BUFLEN 16384 |
| 66 | #define MAX_NAME_LEN 1024 | 66 | #define MAX_NAME_LEN 1024 |
diff --git a/qnx/package.qpg b/qnx/package.qpg new file mode 100644 index 0000000..951f6fa --- /dev/null +++ b/qnx/package.qpg | |||
| @@ -0,0 +1,141 @@ | |||
| 1 | <QPG:Generation> | ||
| 2 | <QPG:Options> | ||
| 3 | <QPG:User unattended="no" verbosity="2" listfiles="yes"/> | ||
| 4 | <QPG:Defaults type="qnx_package"/> | ||
| 5 | <QPG:Source></QPG:Source> | ||
| 6 | <QPG:Release number="+"/> | ||
| 7 | <QPG:Build></QPG:Build> | ||
| 8 | <QPG:FileSorting strip="yes"/> | ||
| 9 | <QPG:Package targets="combine"/> | ||
| 10 | <QPG:Repository generate="yes"/> | ||
| 11 | <QPG:FinalDir></QPG:FinalDir> | ||
| 12 | <QPG:Cleanup></QPG:Cleanup> | ||
| 13 | </QPG:Options> | ||
| 14 | |||
| 15 | <QPG:Responsible> | ||
| 16 | <QPG:Company></QPG:Company> | ||
| 17 | <QPG:Department></QPG:Department> | ||
| 18 | <QPG:Group></QPG:Group> | ||
| 19 | <QPG:Team></QPG:Team> | ||
| 20 | <QPG:Employee></QPG:Employee> | ||
| 21 | <QPG:EmailAddress></QPG:EmailAddress> | ||
| 22 | </QPG:Responsible> | ||
| 23 | |||
| 24 | <QPG:Values> | ||
| 25 | <QPG:Files> | ||
| 26 | <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/> | ||
| 27 | <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/> | ||
| 28 | <QPG:Add file="../libz.so.1.2.0.4" install="/opt/lib/" user="root:bin" permission="644"/> | ||
| 29 | <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.4"/> | ||
| 30 | <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.4"/> | ||
| 31 | <QPG:Add file="../libz.so.1.2.0.4" install="/opt/lib/" component="slib"/> | ||
| 32 | </QPG:Files> | ||
| 33 | |||
| 34 | <QPG:PackageFilter> | ||
| 35 | <QPM:PackageManifest> | ||
| 36 | <QPM:PackageDescription> | ||
| 37 | <QPM:PackageType>Library</QPM:PackageType> | ||
| 38 | <QPM:PackageReleaseNotes></QPM:PackageReleaseNotes> | ||
| 39 | <QPM:PackageReleaseUrgency>Medium</QPM:PackageReleaseUrgency> | ||
| 40 | <QPM:PackageRepository></QPM:PackageRepository> | ||
| 41 | <QPM:FileVersion>2.0</QPM:FileVersion> | ||
| 42 | </QPM:PackageDescription> | ||
| 43 | |||
| 44 | <QPM:ProductDescription> | ||
| 45 | <QPM:ProductName>zlib</QPM:ProductName> | ||
| 46 | <QPM:ProductIdentifier>zlib</QPM:ProductIdentifier> | ||
| 47 | <QPM:ProductEmail>alain.bonnefoy@icbt.com</QPM:ProductEmail> | ||
| 48 | <QPM:VendorName>Public</QPM:VendorName> | ||
| 49 | <QPM:VendorInstallName>public</QPM:VendorInstallName> | ||
| 50 | <QPM:VendorURL>www.gzip.org/zlib</QPM:VendorURL> | ||
| 51 | <QPM:VendorEmbedURL></QPM:VendorEmbedURL> | ||
| 52 | <QPM:VendorEmail></QPM:VendorEmail> | ||
| 53 | <QPM:AuthorName>Jean-Loup Gailly,Mark Adler</QPM:AuthorName> | ||
| 54 | <QPM:AuthorURL>www.gzip.org/zlib</QPM:AuthorURL> | ||
| 55 | <QPM:AuthorEmbedURL></QPM:AuthorEmbedURL> | ||
| 56 | <QPM:AuthorEmail>zlib@gzip.org</QPM:AuthorEmail> | ||
| 57 | <QPM:ProductIconSmall></QPM:ProductIconSmall> | ||
| 58 | <QPM:ProductIconLarge></QPM:ProductIconLarge> | ||
| 59 | <QPM:ProductDescriptionShort>A massively spiffy yet delicately unobtrusive compression library.</QPM:ProductDescriptionShort> | ||
| 60 | <QPM:ProductDescriptionLong>zlib is designed to be a free, general-purpose, legally unencumbered, lossless data compression library for use on virtually any computer hardware and operating system.</QPM:ProductDescriptionLong> | ||
| 61 | <QPM:ProductDescriptionURL>http://www.gzip.org/zlib</QPM:ProductDescriptionURL> | ||
| 62 | <QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL> | ||
| 63 | </QPM:ProductDescription> | ||
| 64 | |||
| 65 | <QPM:ReleaseDescription> | ||
| 66 | <QPM:ReleaseVersion>1.2.0.4</QPM:ReleaseVersion> | ||
| 67 | <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> | ||
| 68 | <QPM:ReleaseStability>Stable</QPM:ReleaseStability> | ||
| 69 | <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor> | ||
| 70 | <QPM:ReleaseNoteMajor></QPM:ReleaseNoteMajor> | ||
| 71 | <QPM:ExcludeCountries> | ||
| 72 | <QPM:Country></QPM:Country> | ||
| 73 | </QPM:ExcludeCountries> | ||
| 74 | |||
| 75 | <QPM:ReleaseCopyright>No License</QPM:ReleaseCopyright> | ||
| 76 | </QPM:ReleaseDescription> | ||
| 77 | |||
| 78 | <QPM:ContentDescription> | ||
| 79 | <QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic> | ||
| 80 | <QPM:ContentKeyword>zlib,compression</QPM:ContentKeyword> | ||
| 81 | <QPM:TargetOS>qnx6</QPM:TargetOS> | ||
| 82 | <QPM:HostOS>qnx6</QPM:HostOS> | ||
| 83 | <QPM:DisplayEnvironment xmlmultiple="true">None</QPM:DisplayEnvironment> | ||
| 84 | <QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience> | ||
| 85 | </QPM:ContentDescription> | ||
| 86 | </QPM:PackageManifest> | ||
| 87 | </QPG:PackageFilter> | ||
| 88 | |||
| 89 | <QPG:PackageFilter proc="none" target="none"> | ||
| 90 | <QPM:PackageManifest> | ||
| 91 | <QPM:ProductInstallationDependencies> | ||
| 92 | <QPM:ProductRequirements></QPM:ProductRequirements> | ||
| 93 | </QPM:ProductInstallationDependencies> | ||
| 94 | |||
| 95 | <QPM:ProductInstallationProcedure> | ||
| 96 | <QPM:Script xmlmultiple="true"> | ||
| 97 | <QPM:ScriptName></QPM:ScriptName> | ||
| 98 | <QPM:ScriptType>Install</QPM:ScriptType> | ||
| 99 | <QPM:ScriptTiming>Post</QPM:ScriptTiming> | ||
| 100 | <QPM:ScriptBlocking>No</QPM:ScriptBlocking> | ||
| 101 | <QPM:ScriptResult>Ignore</QPM:ScriptResult> | ||
| 102 | <QPM:ShortDescription></QPM:ShortDescription> | ||
| 103 | <QPM:UseBinaries>No</QPM:UseBinaries> | ||
| 104 | <QPM:Priority>Optional</QPM:Priority> | ||
| 105 | </QPM:Script> | ||
| 106 | </QPM:ProductInstallationProcedure> | ||
| 107 | </QPM:PackageManifest> | ||
| 108 | |||
| 109 | <QPM:Launch> | ||
| 110 | </QPM:Launch> | ||
| 111 | </QPG:PackageFilter> | ||
| 112 | |||
| 113 | <QPG:PackageFilter type="core" component="none"> | ||
| 114 | <QPM:PackageManifest> | ||
| 115 | <QPM:ProductInstallationProcedure> | ||
| 116 | <QPM:OrderDependency xmlmultiple="true"> | ||
| 117 | <QPM:Order>InstallOver</QPM:Order> | ||
| 118 | <QPM:Product>zlib</QPM:Product> | ||
| 119 | </QPM:OrderDependency> | ||
| 120 | </QPM:ProductInstallationProcedure> | ||
| 121 | </QPM:PackageManifest> | ||
| 122 | |||
| 123 | <QPM:Launch> | ||
| 124 | </QPM:Launch> | ||
| 125 | </QPG:PackageFilter> | ||
| 126 | |||
| 127 | <QPG:PackageFilter type="core" component="dev"> | ||
| 128 | <QPM:PackageManifest> | ||
| 129 | <QPM:ProductInstallationProcedure> | ||
| 130 | <QPM:OrderDependency xmlmultiple="true"> | ||
| 131 | <QPM:Order>InstallOver</QPM:Order> | ||
| 132 | <QPM:Product>zlib-dev</QPM:Product> | ||
| 133 | </QPM:OrderDependency> | ||
| 134 | </QPM:ProductInstallationProcedure> | ||
| 135 | </QPM:PackageManifest> | ||
| 136 | |||
| 137 | <QPM:Launch> | ||
| 138 | </QPM:Launch> | ||
| 139 | </QPG:PackageFilter> | ||
| 140 | </QPG:Values> | ||
| 141 | </QPG:Generation> | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | .TH ZLIB 3 "12 May 2003" | 1 | .TH ZLIB 3 "xx July 2003" |
| 2 | .SH NAME | 2 | .SH NAME |
| 3 | zlib \- compression/decompression library | 3 | zlib \- compression/decompression library |
| 4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
| @@ -133,7 +133,7 @@ before asking for help. | |||
| 133 | Send questions and/or comments to zlib@gzip.org, | 133 | Send questions and/or comments to zlib@gzip.org, |
| 134 | or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). | 134 | or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). |
| 135 | .SH AUTHORS | 135 | .SH AUTHORS |
| 136 | Version 1.2.0.3 | 136 | Version 1.2.0.4 |
| 137 | Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) | 137 | Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) |
| 138 | and Mark Adler (madler@alumni.caltech.edu). | 138 | and Mark Adler (madler@alumni.caltech.edu). |
| 139 | .LP | 139 | .LP |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library | 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library |
| 2 | version 1.2.0.3, July 19th, 2003 | 2 | version 1.2.0.4, August 10th, 2003 |
| 3 | 3 | ||
| 4 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler |
| 5 | 5 | ||
| @@ -37,8 +37,8 @@ | |||
| 37 | extern "C" { | 37 | extern "C" { |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #define ZLIB_VERSION "1.2.0.3" | 40 | #define ZLIB_VERSION "1.2.0.4" |
| 41 | #define ZLIB_VERNUM 0x1203 | 41 | #define ZLIB_VERNUM 0x1204 |
| 42 | 42 | ||
| 43 | /* | 43 | /* |
| 44 | The 'zlib' compression library provides in-memory compression and | 44 | The 'zlib' compression library provides in-memory compression and |
| @@ -446,15 +446,21 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | |||
| 446 | this version of the library. | 446 | this version of the library. |
| 447 | 447 | ||
| 448 | The windowBits parameter is the base two logarithm of the window size | 448 | The windowBits parameter is the base two logarithm of the window size |
| 449 | (the size of the history buffer). It should be in the range 8..15 for this | 449 | (the size of the history buffer). It should be in the range 8..15 for this |
| 450 | version of the library. Larger values of this parameter result in better | 450 | version of the library. Larger values of this parameter result in better |
| 451 | compression at the expense of memory usage. The default value is 15 if | 451 | compression at the expense of memory usage. The default value is 15 if |
| 452 | deflateInit is used instead. | 452 | deflateInit is used instead. |
| 453 | 453 | ||
| 454 | windowBits can also be -8..-15 for raw deflate. In this case, -windowBits | 454 | windowBits can also be -8..-15 for raw deflate. In this case, -windowBits |
| 455 | determines the window size. deflate() will then generate raw deflate data | 455 | determines the window size. deflate() will then generate raw deflate data |
| 456 | with no zlib header or trailer, and will not compute an adler32 check value. | 456 | with no zlib header or trailer, and will not compute an adler32 check value. |
| 457 | 457 | ||
| 458 | windowBits can also be greater than 15 for optional gzip encoding. Add | ||
| 459 | 16 to windowBits to write a simple gzip header and trailer around the | ||
| 460 | compressed data instead of a zlib wrapper. The gzip header will have no | ||
| 461 | file name, no extra data, no comment, no modification time (set to zero), | ||
| 462 | no header crc, and the operating system will be set to 255 (unknown). | ||
| 463 | |||
| 458 | The memLevel parameter specifies how much memory should be allocated | 464 | The memLevel parameter specifies how much memory should be allocated |
| 459 | for the internal compression state. memLevel=1 uses minimum memory but | 465 | for the internal compression state. memLevel=1 uses minimum memory but |
| 460 | is slow and reduces compression ratio; memLevel=9 uses maximum memory | 466 | is slow and reduces compression ratio; memLevel=9 uses maximum memory |
| @@ -801,8 +807,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); | |||
| 801 | Library content (indicates missing functionality): | 807 | Library content (indicates missing functionality): |
| 802 | 16: NO_DEFLATE -- gz* functions cannot compress (to avoid linking deflate | 808 | 16: NO_DEFLATE -- gz* functions cannot compress (to avoid linking deflate |
| 803 | code when not needed) | 809 | code when not needed) |
| 804 | 17: NO_GUNZIP -- inflate can't detect and decode gzip streams, to avoid | 810 | 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect |
| 805 | linking crc code | 811 | and decode gzip streams (to avoid linking crc code) |
| 806 | 18-19: 0 (reserved) | 812 | 18-19: 0 (reserved) |
| 807 | 813 | ||
| 808 | Operation variations (changes in library functionality): | 814 | Operation variations (changes in library functionality): |
| @@ -74,7 +74,7 @@ uLong ZEXPORT zlibCompileFlags() | |||
| 74 | #ifdef NO_DEFLATE | 74 | #ifdef NO_DEFLATE |
| 75 | flags += 1 << 16; | 75 | flags += 1 << 16; |
| 76 | #endif | 76 | #endif |
| 77 | #ifdef NO_GUNZIP | 77 | #ifdef NO_GZIP |
| 78 | flags += 1 << 17; | 78 | flags += 1 << 17; |
| 79 | #endif | 79 | #endif |
| 80 | #ifdef PKZIP_BUG_WORKAROUND | 80 | #ifdef PKZIP_BUG_WORKAROUND |
