File pbzip2-fix_printf_format.patch of Package pbzip2
--- pbzip2.cpp.orig 2011-11-03 09:38:41.289000463 +0100
+++ pbzip2.cpp 2011-11-03 09:46:34.882000462 +0100
@@ -796,7 +796,7 @@
safe_mutex_lock(OutMutex);
#ifdef PBZIP_DEBUG
unsigned long long thid = (unsigned long long) pthread_self();
- fprintf(stderr, "(%"PRIu64") syncSetLastGoodBlock: %d -> %d\n", thid, LastGoodBlock, newValue );
+ fprintf(stderr, "(%zu) syncSetLastGoodBlock: %d -> %d\n", thid, LastGoodBlock, newValue );
#endif
if ( (LastGoodBlock == -1) || (newValue < LastGoodBlock) )
@@ -881,7 +881,7 @@
{
#ifdef PBZIP_DEBUG
unsigned long long thid = (unsigned long long) pthread_self();
- fprintf(stderr, "(%"PRIu64") waitForPreviousBlock before check: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
+ fprintf(stderr, "(%zu) waitForPreviousBlock before check: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
thid,
LastGoodBlock, blockNum, NextBlockToWrite );
#endif
@@ -891,7 +891,7 @@
if (syncGetTerminateFlag() != 0)
{
#ifdef PBZIP_DEBUG
- fprintf(stderr, "(%"PRIu64") waitForPreviousBlock terminated [%d]: blockNum=%d\n",
+ fprintf(stderr, "(%zu) waitForPreviousBlock terminated [%d]: blockNum=%d\n",
thid, -1, blockNum );
#endif
return -1;
@@ -900,14 +900,14 @@
safe_mutex_lock(OutMutex);
#ifdef PBZIP_DEBUG
- fprintf(stderr, "(%"PRIu64") waitForPreviousBlock before check: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
+ fprintf(stderr, "(%zu) waitForPreviousBlock before check: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
thid, LastGoodBlock, blockNum, NextBlockToWrite );
#endif
if (blockNum <= NextBlockToWrite)
{
#ifdef PBZIP_DEBUG
- fprintf(stderr, "(%"PRIu64") waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
+ fprintf(stderr, "(%zu) waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
thid, 0, LastGoodBlock, blockNum, NextBlockToWrite );
#endif
safe_mutex_unlock(OutMutex);
@@ -917,7 +917,7 @@
if ( (LastGoodBlock != -1) && (LastGoodBlock < blockNum) )
{
#ifdef PBZIP_DEBUG
- fprintf(stderr, "(%"PRIu64") waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
+ fprintf(stderr, "(%zu) waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
thid, 2, LastGoodBlock, blockNum, NextBlockToWrite );
#endif
safe_mutex_unlock(OutMutex);
@@ -925,7 +925,7 @@
}
#ifdef PBZIP_DEBUG
- fprintf(stderr, "(%"PRIu64") waitForPreviousBlock to sleep: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
+ fprintf(stderr, "(%zu) waitForPreviousBlock to sleep: LastGoodBlock=%d; blockNum=%d; NextBlockToWrite=%d\n",
thid, LastGoodBlock, blockNum, NextBlockToWrite );
#endif
@@ -1410,8 +1410,8 @@
// give warning to user if block is larger than 250 million bytes
if (fileData->bufSize > 250000000)
{
- fprintf(stderr, "pbzip2: *WARNING: Compressed block size is large [%"PRIu64" bytes].\n",
- (unsigned long long) fileData->bufSize);
+ fprintf(stderr, "pbzip2: *WARNING: Compressed block size is large [%ud bytes].\n",
+ fileData->bufSize);
fprintf(stderr, " If program aborts, use regular BZIP2 to decompress.\n");
}
}
@@ -1434,7 +1434,7 @@
}
}
#ifdef PBZIP_DEBUG
- fprintf(stderr, "producer: Buffer: %x Size: %"PRIu64" Block: %d\n", fileData->buf,
+ fprintf(stderr, "producer: Buffer: %x Size: %zu Block: %d\n", fileData->buf,
(unsigned long long)fileData->bufSize, NumBlocks);
#endif
@@ -1499,7 +1499,7 @@
isInterrupted = true;
#ifdef PBZIP_DEBUG
- fprintf (stderr, "(%"PRIu64") producer_decompress: interrupt1 - TerminateFlag set.\n", thid);
+ fprintf (stderr, "(%zu) producer_decompress: interrupt1 - TerminateFlag set.\n", thid);
#endif
}
if ( (syncGetLastGoodBlock() != -1) &&
@@ -1509,7 +1509,7 @@
isInterrupted = true;
#ifdef PBZIP_DEBUG
- fprintf (stderr, "(%"PRIu64") consumer_decompress: terminating1 - LastGoodBlock set [%d].\n", thid, syncGetLastGoodBlock());
+ fprintf (stderr, "(%zu) consumer_decompress: terminating1 - LastGoodBlock set [%d].\n", thid, syncGetLastGoodBlock());
#endif
}
@@ -2018,7 +2018,7 @@
if (QuietMode != 1)
{
- fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)CompressedSize);
+ fprintf(stderr, " Output Size: %zu bytes\n", CompressedSize);
}
#ifdef PBZIP_DEBUG
@@ -2118,7 +2118,7 @@
inSize = bytesLeft;
#ifdef PBZIP_DEBUG
- fprintf(stderr, " -> Bytes To Read: %"PRIu64" bytes...\n", inSize);
+ fprintf(stderr, " -> Bytes To Read: %zu bytes...\n", inSize);
#endif
// allocate memory to read in file
@@ -2261,7 +2261,7 @@
close(hOutfile);
if (QuietMode != 1)
{
- fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)CompressedSize);
+ fprintf(stderr, " Output Size: %zu bytes\n", CompressedSize);
}
syncSetProducerDone(1); // Not really needed for direct version
@@ -2617,7 +2617,7 @@
inSize = blockSize;
#ifdef PBZIP_DEBUG
- fprintf(stderr, " -> Bytes To Read: %"PRIu64" bytes...\n", inSize);
+ fprintf(stderr, " -> Bytes To Read: %zu bytes...\n", inSize);
#endif
// allocate memory to read in file
@@ -2678,7 +2678,7 @@
}
}
#ifdef PBZIP_DEBUG
- fprintf(stderr, "producer: Buffer: %x Size: %"PRIu64" Block: %d\n", FileData, inSize, NumBlocks);
+ fprintf(stderr, "producer: Buffer: %x Size: %zu Block: %d\n", FileData, inSize, NumBlocks);
#endif
outBuff * queueElement = new(std::nothrow) outBuff(FileData, inSize, NumBlocks, 0);
@@ -2996,7 +2996,7 @@
// unlikely to get here since more likely exception will be thrown
if (OutputBuffer.size() != size)
{
- fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%u! Aborting...\n", size);
+ fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%zu! Aborting...\n", size);
safe_mutex_unlock(OutMutex);
exit(1);
}
@@ -3940,7 +3940,7 @@
#endif
if (sizeof(OFF_T) <= 4)
{
- fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %u bits!\n", sizeof(OFF_T)*CHAR_BIT);
+ fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %zu bits!\n", sizeof(OFF_T)*CHAR_BIT);
if (decompress == 1)
fprintf(stderr, " You will only able to uncompress files smaller than 2GB in size.\n\n");
else
@@ -4309,7 +4309,7 @@
if (decompress == 1)
fprintf(stderr, " BWT Block Size: %c00k\n", BWTblockSizeChar);
if (strcmp(InFilename, "-") != 0)
- fprintf(stderr, " Input Size: %"PRIu64" bytes\n", (unsigned long long)InFileSize);
+ fprintf(stderr, " Input Size: %zu bytes\n", InFileSize);
}
if (decompress == 1)
@@ -4378,7 +4378,7 @@
}
if (QuietMode != 1)
{
- fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)sizeof(Bz2HeaderZero));
+ fprintf(stderr, " Output Size: %zu bytes\n", sizeof(Bz2HeaderZero));
fprintf(stderr, "-------------------------------------------\n");
}
// remove input file unless requested not to by user or error occurred
@@ -4425,7 +4425,7 @@
{
NumBufferedBlocksMax = numCPU;
if (QuietMode != 1)
- fprintf(stderr, "*Warning* Max memory limit increased to %d MB to support %d CPUs\n", ((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
+ fprintf(stderr, "*Warning* Max memory limit increased to %zd MB to support %d CPUs\n", ((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
}
else
{
@@ -4453,7 +4453,7 @@
if (ret != 0)
{
ErrorContext::getInstance()->saveError();
- handle_error(EF_EXIT, 1, "pbzip2: *ERROR: Not enough resources to create consumer thread #%u (code = %d) Aborting...\n", i, ret);
+ handle_error(EF_EXIT, 1, "pbzip2: *ERROR: Not enough resources to create consumer thread #%zu (code = %d) Aborting...\n", i, ret);
ret = pthread_join(TerminatorThread, NULL);
return 1;
}
@@ -4526,7 +4526,7 @@
{
ErrorContext::getInstance()->saveError();
handle_error(EF_EXIT, 1,
- "pbzip2: *ERROR: Not enough resources to create consumer thread #%u (code = %d) Aborting...\n", i, ret);
+ "pbzip2: *ERROR: Not enough resources to create consumer thread #%zu (code = %d) Aborting...\n", i, ret);
pthread_join(TerminatorThread, NULL);
return 1;
}
--- BZ2StreamScanner.cpp.orig 2011-11-03 09:37:54.461000463 +0100
+++ BZ2StreamScanner.cpp 2011-11-03 09:38:32.413000463 +0100
@@ -488,16 +488,16 @@
void BZ2StreamScanner::printCurrentState()
{
- fprintf( stderr, "current=%d, search pos=%d, end pos=%d; s-c=%d"
- "; out buf size=%d; out buf capacity=%d; header found=%d; search status=%d",
+ fprintf( stderr, "current=%ld, search pos=%ld, end pos=%ld; s-c=%ld"
+ "; out buf size=%u; out buf capacity=%zu; header found=%d; search status=%d",
getInBuffCurrent() - getInBuffBegin(),
getInBuffSearchPtr() - getInBuffBegin(),
getInBuffEnd() - getInBuffBegin(),
getInBuffSearchPtr() - getInBuffCurrent(),
- (int)_outBuff.bufSize,
- (int)_outBuffCapacity,
- (int)isBz2HeaderFound(),
- (int)getSearchStatus() );
+ _outBuff.bufSize,
+ _outBuffCapacity,
+ isBz2HeaderFound(),
+ getSearchStatus() );
}
/**