Ah, sorry. I didn't see that there was a newer version because I found pbzip2 here: http://compression.ca/pbzip2/ and the latest version listed there is the 1.1.6 I used.
Yes, that stack overflow answer does seem like the right answer.
Version 1.1.8 seems to have the same issues:
$ make
g++ -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_PTHREAD_SEMANTICS -DUSE_STACKSIZE_CUSTOMIZATION -pthread pbzip2.cpp BZ2StreamScanner.cpp ErrorContext.cpp -o pbzip2 -lbz2 -lpthread
pbzip2.cpp:3071:99: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%u! Aborting...\n", size); ~~ ^~~~ %lu
pbzip2.cpp:4003:79: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat] fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %u bits!\n", sizeof(OFF_T)*CHAR_BIT); ~~ ^~~~~~~~~~~~~~~~~~~~~~ %lu
pbzip2.cpp:4494:92: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
...fprintf(stderr, "*Warning* Max memory limit increased to %d MB to support %d CPUs\n", ((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU); ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %lu
3 warnings generated.
BZ2StreamScanner.cpp:493:4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] getInBuffCurrent() - getInBuffBegin(), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BZ2StreamScanner.cpp:494:4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] getInBuffSearchPtr() - getInBuffBegin(), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BZ2StreamScanner.cpp:495:4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] getInBuffEnd() - getInBuffBegin(), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BZ2StreamScanner.cpp:496:4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat] getInBuffSearchPtr() - getInBuffCurrent(), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
I changed it to use the type safe version as per that SO post and this took care of the compiler warnings. Here's the diff output for the changes to 1.1.8 to remove the warnings (sorry don't have bzr and doesn't look like something worth installing/learning at this point since it appears to be dying slowly):
------------
diff pbzip2-1.1.8/BZ2StreamScanner.cpp pbzip2-1.1.8 2/BZ2StreamScanner.cpp
491c491
< fprintf( stderr, "current=%zd, search pos=%zd, end pos=%zd; s-c=%zd"
---
> fprintf( stderr, "current=%d, search pos=%d, end pos=%d; s-c=%d"
diff pbzip2-1.1.8/pbzip2.cpp pbzip2-1.1.8 2/pbzip2.cpp
3071c3071
< fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%zu! Aborting...\n", size);
---
> fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%u! Aborting...\n", size);
4003c4003
< fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %zu bits!\n", sizeof(OFF_T)*CHAR_BIT);
---
> fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %u bits!\n", sizeof(OFF_T)*CHAR_BIT);
4494c4494
< fprintf(stderr, "*Warning* Max memory limit increased to %zd MB to support %d CPUs\n", ((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
---
> fprintf(stderr, "*Warning* Max memory limit increased to %d MB to support %d CPUs\n", ((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
Ah, sorry. I didn't see that there was a newer version because I found pbzip2 here: http:// compression. ca/pbzip2/ and the latest version listed there is the 1.1.6 I used.
Yes, that stack overflow answer does seem like the right answer.
Version 1.1.8 seems to have the same issues:
$ make SOURCE -D_FILE_ OFFSET_ BITS=64 -D_POSIX_ PTHREAD_ SEMANTICS -DUSE_STACKSIZE _CUSTOMIZATION -pthread pbzip2.cpp BZ2StreamScanne r.cpp ErrorContext.cpp -o pbzip2 -lbz2 -lpthread
fprintf( stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%u! Aborting...\n", size);
~~ ^~~~
%lu
fprintf( stderr, "\npbzip2: *WARNING: off_t variable size only %u bits!\n", sizeof( OFF_T)* CHAR_BIT) ;
~~ ^~~~~~~ ~~~~~~~ ~~~~~~~ ~
%lu stderr, "*Warning* Max memory limit increased to %d MB to support %d CPUs\n", ((NumBufferedBl ocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
~ ~ ^~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~
% lu r.cpp:493: 4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
getInBuffCur rent() - getInBuffBegin(),
^~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~ r.cpp:494: 4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
getInBuffSea rchPtr( ) - getInBuffBegin(),
^~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ r.cpp:495: 4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
getInBuffEnd () - getInBuffBegin(),
^~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~ r.cpp:496: 4: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
getInBuffSea rchPtr( ) - getInBuffCurrent(),
^~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~
g++ -O2 -D_LARGEFILE64_
pbzip2.cpp:3071:99: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
pbzip2.cpp:4003:79: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
pbzip2.cpp:4494:92: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
...fprintf(
3 warnings generated.
BZ2StreamScanne
BZ2StreamScanne
BZ2StreamScanne
BZ2StreamScanne
4 warnings generated.
I changed it to use the type safe version as per that SO post and this took care of the compiler warnings. Here's the diff output for the changes to 1.1.8 to remove the warnings (sorry don't have bzr and doesn't look like something worth installing/learning at this point since it appears to be dying slowly):
------------
diff pbzip2- 1.1.8/BZ2Stream Scanner. cpp pbzip2-1.1.8 2/BZ2StreamScan ner.cpp 1.1.8/pbzip2. cpp pbzip2-1.1.8 2/pbzip2.cpp OFF_T)* CHAR_BIT) ; OFF_T)* CHAR_BIT) ; ocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU); ocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
491c491
< fprintf( stderr, "current=%zd, search pos=%zd, end pos=%zd; s-c=%zd"
---
> fprintf( stderr, "current=%d, search pos=%d, end pos=%d; s-c=%d"
diff pbzip2-
3071c3071
< fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%zu! Aborting...\n", size);
---
> fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%u! Aborting...\n", size);
4003c4003
< fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %zu bits!\n", sizeof(
---
> fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %u bits!\n", sizeof(
4494c4494
< fprintf(stderr, "*Warning* Max memory limit increased to %zd MB to support %d CPUs\n", ((NumBufferedBl
---
> fprintf(stderr, "*Warning* Max memory limit increased to %d MB to support %d CPUs\n", ((NumBufferedBl
------------