Rev 39872 | Rev 41626 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
The changes for R are all to do with portability:__inline__ is not portable.fdopen is POSIX but not C89Solaris' cc objects to inlining functions with names starting with 'main'.C character strings are limited to ca 500 chars.Various casts were missing.*** further changes made in November 2006 were not documented ***diff -u bzip2-1.0.4/blocksort.c bzip2/blocksort.c--- bzip2-1.0.4/blocksort.c 2007-01-03 02:00:55.000000000 +0000+++ bzip2/blocksort.c 2007-05-07 12:56:52.000000000 +0100@@ -28,7 +28,7 @@/*---------------------------------------------*/static-__inline__+R_INLINEvoid fallbackSimpleSort ( UInt32* fmap,UInt32* eclass,Int32 lo,@@ -342,9 +342,10 @@/*---------------------------------------------*//*---------------------------------------------*/+/* Solaris cc objects to inlining functions whose names start with `main' */static-__inline__-Bool mainGtU ( UInt32 i1,+R_INLINE+Bool BZmainGtU ( UInt32 i1,UInt32 i2,UChar* block,UInt16* quadrant,@@ -355,7 +356,7 @@UChar c1, c2;UInt16 s1, s2;- AssertD ( i1 != i2, "mainGtU" );+ AssertD ( i1 != i2, "BZmainGtU" );/* 1 */c1 = block[i1]; c2 = block[i2];if (c1 != c2) return (c1 > c2);@@ -511,7 +512,7 @@if (i > hi) break;v = ptr[i];j = i;- while ( mainGtU (+ while ( BZmainGtU (ptr[j-h]+d, v+d, block, quadrant, nblock, budget) ) {ptr[j] = ptr[j-h];@@ -525,7 +526,7 @@if (i > hi) break;v = ptr[i];j = i;- while ( mainGtU (+ while ( BZmainGtU (ptr[j-h]+d, v+d, block, quadrant, nblock, budget) ) {ptr[j] = ptr[j-h];@@ -539,7 +540,7 @@if (i > hi) break;v = ptr[i];j = i;- while ( mainGtU (+ while ( BZmainGtU (ptr[j-h]+d, v+d, block, quadrant, nblock, budget) ) {ptr[j] = ptr[j-h];@@ -579,7 +580,7 @@}static-__inline__+R_INLINEUChar mmed3 ( UChar a, UChar b, UChar c ){UChar t;diff -u bzip2-1.0.4/bzlib.c bzip2/bzlib.c--- bzip2-1.0.4/bzlib.c 2007-01-03 02:00:55.000000000 +0000+++ bzip2/bzlib.c 2007-05-07 12:56:52.000000000 +0100@@ -53,8 +53,9 @@BZ2_bzlibVersion());+ /* split up over-long message */if (errcode == 1007) {- fprintf(stderr,+ fprintf(stderr, "%s%s%s","\n*** A special note about internal error number 1007 ***\n""\n""Experience suggests that a common cause of i.e. 1007\n"@@ -62,7 +63,7 @@"just happens to cross-check the results of huge numbers of\n""memory reads/writes, and so acts (unintendedly) as a stress\n""test of your memory system.\n"- "\n"+ "\n","I suggest the following: try compressing the file again,\n""possibly monitoring progress in detail with the -vv flag.\n""\n"@@ -72,7 +73,7 @@" (www.memtest86.com). At the time of writing it is free (GPLd).\n"" Memtest86 tests memory much more thorougly than your BIOSs\n"" power-on test, and may find failures that the BIOS doesn't.\n"- "\n"+ "\n","* If the error can be repeatably reproduced, this is a bug in\n"" bzip2, and I would very much like to hear about it. Please\n"" let me know, and, ideally, save a copy of the file causing the\n"@@ -165,7 +166,7 @@if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;if (strm->bzfree == NULL) strm->bzfree = default_bzfree;- s = BZALLOC( sizeof(EState) );+ s = (EState *) BZALLOC( sizeof(EState) );if (s == NULL) return BZ_MEM_ERROR;s->strm = strm;@@ -174,9 +175,9 @@s->ftab = NULL;n = 100000 * blockSize100k;- s->arr1 = BZALLOC( n * sizeof(UInt32) );- s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );- s->ftab = BZALLOC( 65537 * sizeof(UInt32) );+ s->arr1 = (UInt32 *) BZALLOC( n * sizeof(UInt32) );+ s->arr2 = (UInt32 *) BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );+ s->ftab = (UInt32 *) BZALLOC( 65537 * sizeof(UInt32) );if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {if (s->arr1 != NULL) BZFREE(s->arr1);@@ -362,7 +363,7 @@{Bool progress_in = False;Bool progress_out = False;- EState* s = strm->state;+ EState* s = (EState *) strm->state;while (True) {@@ -409,7 +410,7 @@Bool progress;EState* s;if (strm == NULL) return BZ_PARAM_ERROR;- s = strm->state;+ s = (EState *) strm->state;if (s == NULL) return BZ_PARAM_ERROR;if (s->strm != strm) return BZ_PARAM_ERROR;@@ -469,7 +470,7 @@{EState* s;if (strm == NULL) return BZ_PARAM_ERROR;- s = strm->state;+ s = (EState *) strm->state;if (s == NULL) return BZ_PARAM_ERROR;if (s->strm != strm) return BZ_PARAM_ERROR;@@ -505,7 +506,7 @@if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;if (strm->bzfree == NULL) strm->bzfree = default_bzfree;- s = BZALLOC( sizeof(DState) );+ s = (DState *) BZALLOC( sizeof(DState) );if (s == NULL) return BZ_MEM_ERROR;s->strm = strm;strm->state = s;@@ -683,7 +684,10 @@/*---------------------------------------------------*/-__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )+#ifndef __cplusplus+R_INLINE+#endif+Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab ){Int32 nb, na, mid;nb = 0;@@ -809,7 +813,7 @@Bool corrupt;DState* s;if (strm == NULL) return BZ_PARAM_ERROR;- s = strm->state;+ s = (DState *) strm->state;if (s == NULL) return BZ_PARAM_ERROR;if (s->strm != strm) return BZ_PARAM_ERROR;@@ -862,7 +866,7 @@{DState* s;if (strm == NULL) return BZ_PARAM_ERROR;- s = strm->state;+ s = (DState *) strm->state;if (s == NULL) return BZ_PARAM_ERROR;if (s->strm != strm) return BZ_PARAM_ERROR;@@ -933,7 +937,7 @@if (ferror(f)){ BZ_SETERR(BZ_IO_ERROR); return NULL; };- bzf = malloc ( sizeof(bzFile) );+ bzf = (bzFile *) malloc ( sizeof(bzFile) );if (bzf == NULL){ BZ_SETERR(BZ_MEM_ERROR); return NULL; };@@ -981,7 +985,7 @@{ BZ_SETERR(BZ_OK); return; };bzf->strm.avail_in = len;- bzf->strm.next_in = buf;+ bzf->strm.next_in = (char *) buf;while (True) {bzf->strm.avail_out = BZ_MAX_UNUSED;@@ -1106,7 +1110,7 @@if (ferror(f)){ BZ_SETERR(BZ_IO_ERROR); return NULL; };- bzf = malloc ( sizeof(bzFile) );+ bzf = (bzFile *) malloc ( sizeof(bzFile) );if (bzf == NULL){ BZ_SETERR(BZ_MEM_ERROR); return NULL; };@@ -1178,7 +1182,7 @@{ BZ_SETERR(BZ_OK); return 0; };bzf->strm.avail_out = len;- bzf->strm.next_out = buf;+ bzf->strm.next_out = (char *) buf;while (True) {@@ -1378,6 +1382,15 @@#else# define SET_BINARY_MODE(file)#endif++#if !defined(fdopen) && defined(HAVE_FDOPEN)+ FILE *fdopen(int fildes, const char *mode)+#ifdef __cplusplus+ throw ()+#endif+ ;+#endif+staticBZFILE * bzopen_or_bzdopen( const char *path, /* no use when bzdopen */@@ -1424,7 +1437,7 @@fp = fopen(path,mode2);}} else {-#ifdef BZ_STRICT_ANSI+#ifndef HAVE_FDOPENfp = NULL;#elsefp = fdopen(fd,mode2);@@ -1513,10 +1526,9 @@void BZ_API(BZ2_bzclose) (BZFILE* b){int bzerr;- FILE *fp;+ FILE *fp = ((bzFile *)b)->handle;if (b==NULL) {return;}- fp = ((bzFile *)b)->handle;if(((bzFile*)b)->writing){BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);if(bzerr != BZ_OK){diff -u bzip2-1.0.4/bzlib_private.h bzip2/bzlib_private.h--- bzip2-1.0.4/bzlib_private.h 2007-01-03 02:00:55.000000000 +0000+++ bzip2/bzlib_private.h 2007-05-07 12:56:51.000000000 +0100@@ -22,6 +22,7 @@#ifndef _BZLIB_PRIVATE_H#define _BZLIB_PRIVATE_H+#include <config.h> /* for R_INLINE */#include <stdlib.h>#ifndef BZ_NO_STDIOdiff -u bzip2-1.0.4/compress.c bzip2/compress.c--- bzip2-1.0.4/compress.c 2007-01-03 02:00:55.000000000 +0000+++ bzip2/compress.c 2007-05-07 12:56:50.000000000 +0100@@ -69,7 +69,7 @@/*---------------------------------------------------*/static-__inline__+R_INLINEvoid bsW ( EState* s, Int32 n, UInt32 v ){bsNEEDW ( n );diff -u bzip2-1.0.4/decompress.c bzip2/decompress.c--- bzip2-1.0.4/decompress.c 2007-01-03 02:00:55.000000000 +0000+++ bzip2/decompress.c 2007-05-07 12:56:50.000000000 +0100@@ -209,13 +209,13 @@s->blockSize100k -= BZ_HDR_0;if (s->smallDecompress) {- s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );- s->ll4 = BZALLOC(- ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)- );+ s->ll16 = (UInt16*) BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );+ s->ll4 = (UChar *) BZALLOC(+ ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)+ );if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);} else {- s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) );+ s->tt = (UInt32 *) BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) );if (s->tt == NULL) RETURN(BZ_MEM_ERROR);}