Skip to content

Commit

Permalink
Update the bzip library in plugins to version 1.0.8
Browse files Browse the repository at this point in the history
re: Issue Unidata#1969
  • Loading branch information
DennisHeimbigner committed Mar 30, 2021
1 parent a9ba3c5 commit 395f47a
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 35 deletions.
7 changes: 7 additions & 0 deletions plugins/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include $(top_srcdir)/lib_flags.am
AM_LDFLAGS += -module -avoid-version -shared -export-dynamic \
-rpath ${abs_builddir} ${NOUNDEFINED}

# BZIP2 version 1.0.8 (https://sourceware.org/bzip2/)
BZIP2HDRS = bzlib.h bzlib_private.h
BZIP2SRC = blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c

Expand Down Expand Up @@ -41,3 +42,9 @@ DISTCLEANFILES = H5Znoop1.c
H5Znoop1.c: Makefile H5Znoop.c
echo '#define NOOP_INSTANCE 1' > $@
cat ${srcdir}/H5Znoop.c >> $@

# For reference: updating bzip2
BZIP2DIR=/cygdrive/d/bzip2-1.0.8
updatebzip2:
for b in ${BZIP2HDRS} ${BZIP2SRC} ; do cp -f ${BZIP2DIR}/$${b} . ; done

10 changes: 5 additions & 5 deletions plugins/blocksort.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand Down Expand Up @@ -202,9 +202,9 @@ void fallbackQSort3 ( UInt32* fmap,
bhtab [ 0 .. 2+(nblock/32) ] destroyed
*/

#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31))
#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31))
#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31)))
#define SET_BH(zz) bhtab[(zz) >> 5] |= ((UInt32)1 << ((zz) & 31))
#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~((UInt32)1 << ((zz) & 31))
#define ISSET_BH(zz) (bhtab[(zz) >> 5] & ((UInt32)1 << ((zz) & 31)))
#define WORD_BH(zz) bhtab[(zz) >> 5]
#define UNALIGNED_BH(zz) ((zz) & 0x01f)

Expand Down
20 changes: 8 additions & 12 deletions plugins/bzlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand All @@ -30,6 +30,7 @@

#include "bzlib_private.h"


/*---------------------------------------------------*/
/*--- Compression stuff ---*/
/*---------------------------------------------------*/
Expand All @@ -42,12 +43,12 @@ void BZ2_bz__AssertH__fail ( int errcode )
fprintf(stderr,
"\n\nbzip2/libbzip2: internal error number %d.\n"
"This is a bug in bzip2/libbzip2, %s.\n"
"Please report it to me at: jseward@bzip.org. If this happened\n"
"Please report it to: bzip2-devel@sourceware.org. If this happened\n"
"when you were using some program which uses libbzip2 as a\n"
"component, you should also report this bug to the author(s)\n"
"of that program. Please make an effort to report this bug;\n"
"timely and accurate bug reports eventually lead to higher\n"
"quality software. Thanks. Julian Seward, 10 December 2007.\n\n",
"quality software. Thanks.\n\n",
errcode,
BZ2_bzlibVersion()
);
Expand Down Expand Up @@ -1380,8 +1381,8 @@ const char * BZ_API(BZ2_bzlibVersion)(void)
#endif
static
BZFILE * bzopen_or_bzdopen
( const char *path, /* not used when bzdopen */
int fd, /* not used when bzdopen */
( const char *path, /* no use when bzdopen */
int fd, /* no use when bzdopen */
const char *mode,
int open_mode) /* bzopen: 0, bzdopen:1 */
{
Expand Down Expand Up @@ -1424,14 +1425,10 @@ BZFILE * bzopen_or_bzdopen
fp = fopen(path,mode2);
}
} else {
#if 0
#ifdef BZ_STRICT_ANSI
fp = NULL;
#else
fp = fdopen(fd,mode2);
#endif
#else
fp = NULL;
#endif
}
if (fp == NULL) return NULL;
Expand Down Expand Up @@ -1469,14 +1466,13 @@ BZFILE * BZ_API(BZ2_bzopen)


/*---------------------------------------------------*/
#if 0
BZFILE * BZ_API(BZ2_bzdopen)
( int fd,
const char *mode )
{
return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1);
}
#endif


/*---------------------------------------------------*/
int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
Expand Down
4 changes: 2 additions & 2 deletions plugins/bzlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand Down
6 changes: 3 additions & 3 deletions plugins/bzlib_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand All @@ -36,7 +36,7 @@

/*-- General stuff. --*/

#define BZ_VERSION "1.0.6, 6-Sept-2010"
#define BZ_VERSION "1.0.8, 13-Jul-2019"

typedef char Char;
typedef unsigned char Bool;
Expand Down
6 changes: 3 additions & 3 deletions plugins/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand Down Expand Up @@ -454,7 +454,7 @@ void sendMTFValues ( EState* s )

AssertH( nGroups < 8, 3002 );
AssertH( nSelectors < 32768 &&
nSelectors <= (2 + (900000 / BZ_G_SIZE)),
nSelectors <= BZ_MAX_SELECTORS,
3003 );


Expand Down
4 changes: 2 additions & 2 deletions plugins/crctable.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand Down
14 changes: 10 additions & 4 deletions plugins/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand Down Expand Up @@ -285,7 +285,7 @@ Int32 BZ2_decompress ( DState* s )

/*--- Now the selectors ---*/
GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR);
GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
for (i = 0; i < nSelectors; i++) {
Expand All @@ -296,8 +296,14 @@ Int32 BZ2_decompress ( DState* s )
j++;
if (j >= nGroups) RETURN(BZ_DATA_ERROR);
}
s->selectorMtf[i] = j;
/* Having more than BZ_MAX_SELECTORS doesn't make much sense
since they will never be used, but some implementations might
"round up" the number of selectors, so just ignore those. */
if (i < BZ_MAX_SELECTORS)
s->selectorMtf[i] = j;
}
if (nSelectors > BZ_MAX_SELECTORS)
nSelectors = BZ_MAX_SELECTORS;

/*--- Undo the MTF values for the selectors. ---*/
{
Expand Down
4 changes: 2 additions & 2 deletions plugins/huffman.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand Down
4 changes: 2 additions & 2 deletions plugins/randtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
Expand Down

0 comments on commit 395f47a

Please sign in to comment.