diff options
Diffstat (limited to 'compress.c')
-rw-r--r-- | compress.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -8,7 +8,7 @@ | |||
8 | This file is a part of bzip2 and/or libbzip2, a program and | 8 | This file is a part of bzip2 and/or libbzip2, a program and |
9 | library for lossless, block-sorting data compression. | 9 | library for lossless, block-sorting data compression. |
10 | 10 | ||
11 | Copyright (C) 1996-2002 Julian R Seward. All rights reserved. | 11 | Copyright (C) 1996-2005 Julian R Seward. All rights reserved. |
12 | 12 | ||
13 | Redistribution and use in source and binary forms, with or without | 13 | Redistribution and use in source and binary forms, with or without |
14 | modification, are permitted provided that the following conditions | 14 | modification, are permitted provided that the following conditions |
@@ -42,7 +42,7 @@ | |||
42 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 42 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
43 | 43 | ||
44 | Julian Seward, Cambridge, UK. | 44 | Julian Seward, Cambridge, UK. |
45 | jseward@acm.org | 45 | jseward@bzip.org |
46 | bzip2/libbzip2 version 1.0 of 21 March 2000 | 46 | bzip2/libbzip2 version 1.0 of 21 March 2000 |
47 | 47 | ||
48 | This program is based on (at least) the work of: | 48 | This program is based on (at least) the work of: |
@@ -488,9 +488,11 @@ void sendMTFValues ( EState* s ) | |||
488 | /*-- | 488 | /*-- |
489 | Recompute the tables based on the accumulated frequencies. | 489 | Recompute the tables based on the accumulated frequencies. |
490 | --*/ | 490 | --*/ |
491 | /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See | ||
492 | comment in huffman.c for details. */ | ||
491 | for (t = 0; t < nGroups; t++) | 493 | for (t = 0; t < nGroups; t++) |
492 | BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), | 494 | BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), |
493 | alphaSize, 20 ); | 495 | alphaSize, 17 /*20*/ ); |
494 | } | 496 | } |
495 | 497 | ||
496 | 498 | ||
@@ -527,7 +529,7 @@ void sendMTFValues ( EState* s ) | |||
527 | if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; | 529 | if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; |
528 | if (s->len[t][i] < minLen) minLen = s->len[t][i]; | 530 | if (s->len[t][i] < minLen) minLen = s->len[t][i]; |
529 | } | 531 | } |
530 | AssertH ( !(maxLen > 20), 3004 ); | 532 | AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); |
531 | AssertH ( !(minLen < 1), 3005 ); | 533 | AssertH ( !(minLen < 1), 3005 ); |
532 | BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), | 534 | BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), |
533 | minLen, maxLen, alphaSize ); | 535 | minLen, maxLen, alphaSize ); |
@@ -651,8 +653,8 @@ void BZ2_compressBlock ( EState* s, Bool is_last_block ) | |||
651 | if (s->blockNo > 1) s->numZ = 0; | 653 | if (s->blockNo > 1) s->numZ = 0; |
652 | 654 | ||
653 | if (s->verbosity >= 2) | 655 | if (s->verbosity >= 2) |
654 | VPrintf4( " block %d: crc = 0x%8x, " | 656 | VPrintf4( " block %d: crc = 0x%08x, " |
655 | "combined CRC = 0x%8x, size = %d\n", | 657 | "combined CRC = 0x%08x, size = %d\n", |
656 | s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); | 658 | s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); |
657 | 659 | ||
658 | BZ2_blockSort ( s ); | 660 | BZ2_blockSort ( s ); |
@@ -703,7 +705,7 @@ void BZ2_compressBlock ( EState* s, Bool is_last_block ) | |||
703 | bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); | 705 | bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); |
704 | bsPutUInt32 ( s, s->combinedCRC ); | 706 | bsPutUInt32 ( s, s->combinedCRC ); |
705 | if (s->verbosity >= 2) | 707 | if (s->verbosity >= 2) |
706 | VPrintf1( " final combined CRC = 0x%x\n ", s->combinedCRC ); | 708 | VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC ); |
707 | bsFinishWrite ( s ); | 709 | bsFinishWrite ( s ); |
708 | } | 710 | } |
709 | } | 711 | } |