summaryrefslogtreecommitdiff
path: root/usr/src/common/bzip2/Solaris.README.txt
blob: 248641c084e14095fff60359343d46109d53fa5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

The source in this directory has been derived from libbzip2 version
1.0.6 downloaded from http://www.bzip.org.

In an effort to provide ease of syncing with the upstream code, this
source hasn't changed much. The usual Solaris coding standards have
been waived. It does not pass cstyle. But, enough modifications were
made so that the code does compile and lint cleanly.

Some modifications have been made for use in the Solaris kernel:
1) compilation errors were corrected
2) lint complaints were fixed
3) a few utility interfaces were added
	BZ2_bzCompressInitSize
	BZ2_bzCompressReset
	BZ2_bzDecompressReset
	BZ2_bzErrorString


Here is a complete list of changes made by Sun to the original 1.0.6
source:

diff -u bzip2-1.0.6/bzlib.c ./bzlib.c
--- bzip2-1.0.6/bzlib.c	Fri Sep 10 18:38:23 2010
+++ ./bzlib.c	Wed Dec 29 20:47:11 2010
@@ -96,11 +96,89 @@
    return 1;
 }
 
+/*
+ * Added for Solaris kernel
+ */
+#define BZES \
+BZE(BZ_OK) \
+BZE(BZ_RUN_OK) \
+BZE(BZ_FLUSH_OK) \
+BZE(BZ_FINISH_OK) \
+BZE(BZ_STREAM_END) \
+BZE(BZ_SEQUENCE_ERROR) \
+BZE(BZ_PARAM_ERROR) \
+BZE(BZ_MEM_ERROR) \
+BZE(BZ_DATA_ERROR) \
+BZE(BZ_DATA_ERROR_MAGIC) \
+BZE(BZ_IO_ERROR) \
+BZE(BZ_UNEXPECTED_EOF) \
+BZE(BZ_OUTBUFF_FULL) \
+BZE(BZ_CONFIG_ERROR) 
 
+BZ_EXTERN const char * BZ_API(BZ2_bzErrorString) ( 
+      int error_code
+   )
+{
+	switch (error_code)
+	{
+#define BZE(x) case x: return (#x);
+BZES
+#undef BZE
+	}
+	return ("BZ_UNKNOWN_ERROR");
+}
+
+#include <sys/sysmacros.h>
+
+#ifdef _KERNEL
+
+#include <sys/types.h>
+#include <sys/cmn_err.h>
+#include <sys/kmem.h>
+
+void
+bz_internal_error(int errcode)
+{
+	panic("bzip2 internal error: %s\n", BZ2_bzErrorString(errcode));
+}
+
 /*---------------------------------------------------*/
+typedef struct {
+	char *buf;
+	size_t sz;
+} bzap;
+
 static
 void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
 {
+	size_t sz = sizeof (bzap) + BZ2_BZALLOC_ALIGN + (items * size);
+	uintptr_t p = (uintptr_t)kmem_alloc(sz, KM_SLEEP);
+
+	if (p != NULL) {
+		bzap *pp = (bzap *)((p + sizeof (bzap) + BZ2_BZALLOC_ALIGN - 1) &
+		    -BZ2_BZALLOC_ALIGN);
+		pp[-1].buf = (void *)p;
+		pp[-1].sz = sz;
+		return (pp);
+	}
+	return (NULL);
+}
+
+static
+void default_bzfree ( void* opaque, void* addr )
+{
+	if (addr != NULL) {
+		bzap *pp = (bzap *)addr - 1;
+		kmem_free(pp->buf, pp->sz);
+	}
+}
+
+#else
+
+/*---------------------------------------------------*/
+static
+void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
+{
    void* v = malloc ( items * size );
    return v;
 }
@@ -110,8 +188,8 @@
 {
    if (addr != NULL) free ( addr );
 }
+#endif	/* _KERNEL */
 
-
 /*---------------------------------------------------*/
 static
 void prepare_new_block ( EState* s )
@@ -210,8 +288,92 @@
    return BZ_OK;
 }
 
+/*---------------------------------------------------*/
+/*
+ * returns the BZALLOC size needed for bzCompressInit
+ */
+int BZ_API(BZ2_bzCompressInitSize) ( 
+                     int        blockSize100k)
+{
+   Int32   n, t;
 
+   n       = 100000 * blockSize100k;
+   t       = 0;
+   t += ( sizeof(EState) );
+   t = P2ROUNDUP(t, BZ2_BZALLOC_ALIGN);
+   t += ( n                  * sizeof(UInt32) );
+   t = P2ROUNDUP(t, BZ2_BZALLOC_ALIGN);
+   t += ( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
+   t = P2ROUNDUP(t, BZ2_BZALLOC_ALIGN);
+   t += ( 65537              * sizeof(UInt32) );
+   t = P2ROUNDUP(t, BZ2_BZALLOC_ALIGN);
+   return (t);
+}
+
 /*---------------------------------------------------*/
+/*
+ * added to allow reuse of bz_stream without malloc/free
+ */
+int BZ_API(BZ2_bzCompressReset) ( bz_stream *strm )
+{
+   EState* s = strm->state;
+
+   if (!bz_config_ok()) return BZ_CONFIG_ERROR;
+
+   if (s == NULL) return BZ_MEM_ERROR;
+   s->strm = strm;
+
+   s->blockNo           = 0;
+   s->state             = BZ_S_INPUT;
+   s->mode              = BZ_M_RUNNING;
+   s->combinedCRC       = 0;
+   s->nblockMAX         = 100000 * s->blockSize100k - 19;
+
+   s->block             = (UChar*)s->arr2;
+   s->mtfv              = (UInt16*)s->arr1;
+   s->zbits             = NULL;
+   s->ptr               = (UInt32*)s->arr1;
+
+   strm->state          = s;
+   strm->total_in_lo32  = 0;
+   strm->total_in_hi32  = 0;
+   strm->total_out_lo32 = 0;
+   strm->total_out_hi32 = 0;
+   init_RL ( s );
+   prepare_new_block ( s );
+   return BZ_OK;
+}
+
+int BZ_API(BZ2_bzDecompressReset) ( bz_stream* strm )
+{
+   DState* s = strm->state;
+
+   if (!bz_config_ok()) return BZ_CONFIG_ERROR;
+
+   if (strm == NULL) return BZ_PARAM_ERROR;
+
+   s->strm                  = strm;
+
+   s->state                 = BZ_X_MAGIC_1;
+   s->bsLive                = 0;
+   s->bsBuff                = 0;
+   s->calculatedCombinedCRC = 0;
+   strm->total_in_lo32      = 0;
+   strm->total_in_hi32      = 0;
+   strm->total_out_lo32     = 0;
+   strm->total_out_hi32     = 0;
+
+   s->ll4                   = NULL;
+   s->ll16                  = NULL;
+   s->tt                    = NULL;
+   s->currBlockNo           = 0;
+
+
+   return BZ_OK;
+}
+
+
+/*---------------------------------------------------*/
 static
 void add_pair_to_block ( EState* s )
 {
@@ -852,9 +1014,11 @@
       }
    }
 
+#if 0
    AssertH ( 0, 6001 );
 
    return 0;  /*NOTREACHED*/
+#endif
 }
 
 
@@ -1078,7 +1242,7 @@
       *nbytes_out_hi32 = bzf->strm.total_out_hi32;
 
    BZ_SETERR(BZ_OK);
-   BZ2_bzCompressEnd ( &(bzf->strm) );
+   (void) BZ2_bzCompressEnd ( &(bzf->strm) );
    free ( bzf );
 }
 
@@ -1152,7 +1316,7 @@
       { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
 
    if (bzf->initialisedOk)
-      (void)BZ2_bzDecompressEnd ( &(bzf->strm) );
+      (void) BZ2_bzDecompressEnd ( &(bzf->strm) );
    free ( bzf );
 }
 
@@ -1282,15 +1446,15 @@
 
    /* normal termination */
    *destLen -= strm.avail_out;   
-   BZ2_bzCompressEnd ( &strm );
+   (void) BZ2_bzCompressEnd ( &strm );
    return BZ_OK;
 
    output_overflow:
-   BZ2_bzCompressEnd ( &strm );
+   (void) BZ2_bzCompressEnd ( &strm );
    return BZ_OUTBUFF_FULL;
 
    errhandler:
-   BZ2_bzCompressEnd ( &strm );
+   (void) BZ2_bzCompressEnd ( &strm );
    return ret;
 }
 
@@ -1330,20 +1494,20 @@
 
    /* normal termination */
    *destLen -= strm.avail_out;
-   BZ2_bzDecompressEnd ( &strm );
+   (void) BZ2_bzDecompressEnd ( &strm );
    return BZ_OK;
 
    output_overflow_or_eof:
    if (strm.avail_out > 0) {
-      BZ2_bzDecompressEnd ( &strm );
+      (void) BZ2_bzDecompressEnd ( &strm );
       return BZ_UNEXPECTED_EOF;
    } else {
-      BZ2_bzDecompressEnd ( &strm );
+      (void) BZ2_bzDecompressEnd ( &strm );
       return BZ_OUTBUFF_FULL;
-   };      
+   }   
 
    errhandler:
-   BZ2_bzDecompressEnd ( &strm );
+   (void) BZ2_bzDecompressEnd ( &strm );
    return ret; 
 }
 
diff -u bzip2-1.0.6/bzlib.h ./bzlib.h
--- bzip2-1.0.6/bzlib.h	Fri Sep 10 19:08:42 2010
+++ ./bzlib.h	Wed Dec 29 20:59:21 2010
@@ -18,10 +18,13 @@
    in the file LICENSE.
    ------------------------------------------------------------------ */
 
-
 #ifndef _BZLIB_H
 #define _BZLIB_H
 
+#ifdef _KERNEL
+#define	BZ_NO_STDIO
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -97,6 +100,8 @@
 
 /*-- Core (low-level) library functions --*/
 
+#define	BZ2_BZALLOC_ALIGN	(64)
+
 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
       bz_stream* strm, 
       int        blockSize100k, 
@@ -104,6 +109,14 @@
       int        workFactor 
    );
 
+BZ_EXTERN int BZ_API(BZ2_bzCompressInitSize) ( 
+      int        blockSize100k
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzCompressReset) ( 
+      bz_stream* strm 
+   );
+
 BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
       bz_stream* strm, 
       int action 
@@ -119,6 +132,10 @@
       int       small
    );
 
+BZ_EXTERN int BZ_API(BZ2_bzDecompressReset) ( 
+      bz_stream* strm 
+   );
+
 BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
       bz_stream* strm 
    );
@@ -127,8 +144,12 @@
       bz_stream *strm 
    );
 
+BZ_EXTERN const char * BZ_API(BZ2_bzErrorString) ( 
+      int error_code
+   );
 
 
+
 /*-- High(er) level library functions --*/
 
 #ifndef BZ_NO_STDIO
@@ -275,8 +296,7 @@
 }
 #endif
 
-#endif
-
 /*-------------------------------------------------------------*/
 /*--- end                                           bzlib.h ---*/
 /*-------------------------------------------------------------*/
+#endif /* _BZLIB_H */
diff -u bzip2-1.0.6/bzlib_private.h ./bzlib_private.h
--- bzip2-1.0.6/bzlib_private.h	Fri Sep 10 18:41:55 2010
+++ ./bzlib_private.h	Wed Dec 29 21:01:01 2010
@@ -22,7 +22,11 @@
 #ifndef _BZLIB_PRIVATE_H
 #define _BZLIB_PRIVATE_H
 
+#ifdef _KERNEL
+#define	BZ_NO_STDIO
+#else
 #include <stdlib.h>
+#endif
 
 #ifndef BZ_NO_STDIO
 #include <stdio.h>
@@ -85,9 +89,10 @@
 
 #else
 
+#pragma weak bz_internal_error
 extern void bz_internal_error ( int errcode );
 #define AssertH(cond,errcode) \
-   { if (!(cond)) bz_internal_error ( errcode ); }
+   { if (!(cond) && &bz_internal_error != NULL) bz_internal_error ( errcode ); }
 #define AssertD(cond,msg)                do { } while (0)
 #define VPrintf0(zf)                     do { } while (0)
 #define VPrintf1(zf,za1)                 do { } while (0)
@@ -156,7 +161,7 @@
 
 #define BZ_INITIALISE_CRC(crcVar)              \
 {                                              \
-   crcVar = 0xffffffffL;                       \
+   crcVar = 0xffffffffUL;                      \
 }
 
 #define BZ_FINALISE_CRC(crcVar)                \
@@ -492,9 +497,6 @@
                            Int32,  Int32, Int32 );
 
 
-#endif
-
-
 /*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
 
 #ifdef BZ_NO_STDIO
@@ -507,3 +509,4 @@
 /*-------------------------------------------------------------*/
 /*--- end                                   bzlib_private.h ---*/
 /*-------------------------------------------------------------*/
+#endif	/* _BZLIB_PRIVATE_H */
diff -u bzip2-1.0.6/crctable.c ./crctable.c
--- bzip2-1.0.6/crctable.c	Fri Sep 10 18:43:34 2010
+++ ./crctable.c	Wed Dec 29 21:01:57 2010
@@ -32,70 +32,70 @@
 
    /*-- Ugly, innit? --*/
 
-   0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L,
-   0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L,
-   0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L,
-   0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL,
-   0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L,
-   0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L,
-   0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L,
-   0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL,
-   0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L,
-   0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L,
-   0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L,
-   0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL,
-   0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L,
-   0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L,
-   0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L,
-   0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL,
-   0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL,
-   0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L,
-   0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L,
-   0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL,
-   0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL,
-   0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L,
-   0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L,
-   0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL,
-   0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL,
-   0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L,
-   0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L,
-   0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL,
-   0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL,
-   0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L,
-   0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L,
-   0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL,
-   0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L,
-   0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL,
-   0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL,
-   0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L,
-   0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L,
-   0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL,
-   0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL,
-   0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L,
-   0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L,
-   0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL,
-   0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL,
-   0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L,
-   0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L,
-   0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL,
-   0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL,
-   0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L,
-   0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L,
-   0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL,
-   0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L,
-   0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L,
-   0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L,
-   0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL,
-   0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L,
-   0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L,
-   0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L,
-   0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL,
-   0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L,
-   0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L,
-   0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L,
-   0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL,
-   0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L,
-   0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L
+   0x00000000UL, 0x04c11db7UL, 0x09823b6eUL, 0x0d4326d9UL,
+   0x130476dcUL, 0x17c56b6bUL, 0x1a864db2UL, 0x1e475005UL,
+   0x2608edb8UL, 0x22c9f00fUL, 0x2f8ad6d6UL, 0x2b4bcb61UL,
+   0x350c9b64UL, 0x31cd86d3UL, 0x3c8ea00aUL, 0x384fbdbdUL,
+   0x4c11db70UL, 0x48d0c6c7UL, 0x4593e01eUL, 0x4152fda9UL,
+   0x5f15adacUL, 0x5bd4b01bUL, 0x569796c2UL, 0x52568b75UL,
+   0x6a1936c8UL, 0x6ed82b7fUL, 0x639b0da6UL, 0x675a1011UL,
+   0x791d4014UL, 0x7ddc5da3UL, 0x709f7b7aUL, 0x745e66cdUL,
+   0x9823b6e0UL, 0x9ce2ab57UL, 0x91a18d8eUL, 0x95609039UL,
+   0x8b27c03cUL, 0x8fe6dd8bUL, 0x82a5fb52UL, 0x8664e6e5UL,
+   0xbe2b5b58UL, 0xbaea46efUL, 0xb7a96036UL, 0xb3687d81UL,
+   0xad2f2d84UL, 0xa9ee3033UL, 0xa4ad16eaUL, 0xa06c0b5dUL,
+   0xd4326d90UL, 0xd0f37027UL, 0xddb056feUL, 0xd9714b49UL,
+   0xc7361b4cUL, 0xc3f706fbUL, 0xceb42022UL, 0xca753d95UL,
+   0xf23a8028UL, 0xf6fb9d9fUL, 0xfbb8bb46UL, 0xff79a6f1UL,
+   0xe13ef6f4UL, 0xe5ffeb43UL, 0xe8bccd9aUL, 0xec7dd02dUL,
+   0x34867077UL, 0x30476dc0UL, 0x3d044b19UL, 0x39c556aeUL,
+   0x278206abUL, 0x23431b1cUL, 0x2e003dc5UL, 0x2ac12072UL,
+   0x128e9dcfUL, 0x164f8078UL, 0x1b0ca6a1UL, 0x1fcdbb16UL,
+   0x018aeb13UL, 0x054bf6a4UL, 0x0808d07dUL, 0x0cc9cdcaUL,
+   0x7897ab07UL, 0x7c56b6b0UL, 0x71159069UL, 0x75d48ddeUL,
+   0x6b93dddbUL, 0x6f52c06cUL, 0x6211e6b5UL, 0x66d0fb02UL,
+   0x5e9f46bfUL, 0x5a5e5b08UL, 0x571d7dd1UL, 0x53dc6066UL,
+   0x4d9b3063UL, 0x495a2dd4UL, 0x44190b0dUL, 0x40d816baUL,
+   0xaca5c697UL, 0xa864db20UL, 0xa527fdf9UL, 0xa1e6e04eUL,
+   0xbfa1b04bUL, 0xbb60adfcUL, 0xb6238b25UL, 0xb2e29692UL,
+   0x8aad2b2fUL, 0x8e6c3698UL, 0x832f1041UL, 0x87ee0df6UL,
+   0x99a95df3UL, 0x9d684044UL, 0x902b669dUL, 0x94ea7b2aUL,
+   0xe0b41de7UL, 0xe4750050UL, 0xe9362689UL, 0xedf73b3eUL,
+   0xf3b06b3bUL, 0xf771768cUL, 0xfa325055UL, 0xfef34de2UL,
+   0xc6bcf05fUL, 0xc27dede8UL, 0xcf3ecb31UL, 0xcbffd686UL,
+   0xd5b88683UL, 0xd1799b34UL, 0xdc3abdedUL, 0xd8fba05aUL,
+   0x690ce0eeUL, 0x6dcdfd59UL, 0x608edb80UL, 0x644fc637UL,
+   0x7a089632UL, 0x7ec98b85UL, 0x738aad5cUL, 0x774bb0ebUL,
+   0x4f040d56UL, 0x4bc510e1UL, 0x46863638UL, 0x42472b8fUL,
+   0x5c007b8aUL, 0x58c1663dUL, 0x558240e4UL, 0x51435d53UL,
+   0x251d3b9eUL, 0x21dc2629UL, 0x2c9f00f0UL, 0x285e1d47UL,
+   0x36194d42UL, 0x32d850f5UL, 0x3f9b762cUL, 0x3b5a6b9bUL,
+   0x0315d626UL, 0x07d4cb91UL, 0x0a97ed48UL, 0x0e56f0ffUL,
+   0x1011a0faUL, 0x14d0bd4dUL, 0x19939b94UL, 0x1d528623UL,
+   0xf12f560eUL, 0xf5ee4bb9UL, 0xf8ad6d60UL, 0xfc6c70d7UL,
+   0xe22b20d2UL, 0xe6ea3d65UL, 0xeba91bbcUL, 0xef68060bUL,
+   0xd727bbb6UL, 0xd3e6a601UL, 0xdea580d8UL, 0xda649d6fUL,
+   0xc423cd6aUL, 0xc0e2d0ddUL, 0xcda1f604UL, 0xc960ebb3UL,
+   0xbd3e8d7eUL, 0xb9ff90c9UL, 0xb4bcb610UL, 0xb07daba7UL,
+   0xae3afba2UL, 0xaafbe615UL, 0xa7b8c0ccUL, 0xa379dd7bUL,
+   0x9b3660c6UL, 0x9ff77d71UL, 0x92b45ba8UL, 0x9675461fUL,
+   0x8832161aUL, 0x8cf30badUL, 0x81b02d74UL, 0x857130c3UL,
+   0x5d8a9099UL, 0x594b8d2eUL, 0x5408abf7UL, 0x50c9b640UL,
+   0x4e8ee645UL, 0x4a4ffbf2UL, 0x470cdd2bUL, 0x43cdc09cUL,
+   0x7b827d21UL, 0x7f436096UL, 0x7200464fUL, 0x76c15bf8UL,
+   0x68860bfdUL, 0x6c47164aUL, 0x61043093UL, 0x65c52d24UL,
+   0x119b4be9UL, 0x155a565eUL, 0x18197087UL, 0x1cd86d30UL,
+   0x029f3d35UL, 0x065e2082UL, 0x0b1d065bUL, 0x0fdc1becUL,
+   0x3793a651UL, 0x3352bbe6UL, 0x3e119d3fUL, 0x3ad08088UL,
+   0x2497d08dUL, 0x2056cd3aUL, 0x2d15ebe3UL, 0x29d4f654UL,
+   0xc5a92679UL, 0xc1683bceUL, 0xcc2b1d17UL, 0xc8ea00a0UL,
+   0xd6ad50a5UL, 0xd26c4d12UL, 0xdf2f6bcbUL, 0xdbee767cUL,
+   0xe3a1cbc1UL, 0xe760d676UL, 0xea23f0afUL, 0xeee2ed18UL,
+   0xf0a5bd1dUL, 0xf464a0aaUL, 0xf9278673UL, 0xfde69bc4UL,
+   0x89b8fd09UL, 0x8d79e0beUL, 0x803ac667UL, 0x84fbdbd0UL,
+   0x9abc8bd5UL, 0x9e7d9662UL, 0x933eb0bbUL, 0x97ffad0cUL,
+   0xafb010b1UL, 0xab710d06UL, 0xa6322bdfUL, 0xa2f33668UL,
+   0xbcb4666dUL, 0xb8757bdaUL, 0xb5365d03UL, 0xb1f740b4UL
 };
 
 
diff -u bzip2-1.0.6/decompress.c ./decompress.c
--- bzip2-1.0.6/decompress.c	Fri Sep 10 18:43:17 2010
+++ ./decompress.c	Fri Dec 31 00:58:25 2010
@@ -38,7 +38,7 @@
 
 /*---------------------------------------------------*/
 #define RETURN(rrr)                               \
-   { retVal = rrr; goto save_state_and_return; };
+   { retVal = rrr; goto save_state_and_return; }
 
 #define GET_BITS(lll,vvv,nnn)                     \
    case lll: s->state = lll;                      \
@@ -505,13 +505,13 @@
       for (i = 0; i <= 256; i++) {
          if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
             /* s->cftab[i] can legitimately be == nblock */
-            RETURN(BZ_DATA_ERROR);
+            RETURN(BZ_DATA_ERROR)
          }
       }
       /* Check: cftab entries non-descending. */
       for (i = 1; i <= 256; i++) {
          if (s->cftab[i-1] > s->cftab[i]) {
-            RETURN(BZ_DATA_ERROR);
+            RETURN(BZ_DATA_ERROR)
          }
       }
 
@@ -575,7 +575,7 @@
 
       }
 
-      RETURN(BZ_OK);
+      RETURN(BZ_OK)
 
 
 
@@ -603,7 +603,7 @@
       s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
 
       s->state = BZ_X_IDLE;
-      RETURN(BZ_STREAM_END);
+      RETURN(BZ_STREAM_END)
 
       default: AssertH ( False, 4001 );
    }