Merge lp:~yavor-nikolov/pbzip2/bug-1236086-printf-numeric-type-alignment into lp:pbzip2/1.1

Proposed by Yavor Nikolov
Status: Merged
Merged at revision: 40
Proposed branch: lp:~yavor-nikolov/pbzip2/bug-1236086-printf-numeric-type-alignment
Merge into: lp:pbzip2/1.1
Diff against target: 474 lines (+71/-63)
5 files modified
BZ2StreamScanner.cpp (+15/-13)
BZ2StreamScanner.h (+2/-0)
ChangeLog (+1/-0)
pbzip2.cpp (+50/-50)
pbzip2.h (+3/-0)
To merge this branch: bzr merge lp:~yavor-nikolov/pbzip2/bug-1236086-printf-numeric-type-alignment
Reviewer Review Type Date Requested Status
Yavor Nikolov Approve
Review via email: mp+215574@code.launchpad.net

Description of the change

Fix for #1236086 (printf format vs actual type alignment)

To post a comment you must log in.
42. By Yavor Nikolov

More printf format vs type alignment fixes (1236086)

43. By Yavor Nikolov

More fixes of printf format vs actual type alignment

Revision history for this message
Yavor Nikolov (yavor-nikolov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'BZ2StreamScanner.cpp'
--- BZ2StreamScanner.cpp 2011-02-12 13:35:21 +0000
+++ BZ2StreamScanner.cpp 2014-04-13 13:56:00 +0000
@@ -111,7 +111,7 @@
111int BZ2StreamScanner::ensureOutBuffCapacity( size_t newSize )111int BZ2StreamScanner::ensureOutBuffCapacity( size_t newSize )
112{112{
113 #ifdef PBZIP_DEBUG113 #ifdef PBZIP_DEBUG
114 fprintf( stderr, " start ensureOutBuffCapacity/newSize=%u: [", newSize );114 fprintf( stderr, " start ensureOutBuffCapacity/newSize=%"PRIuMAX": [", (uintmax_t) newSize );
115 printCurrentState();115 printCurrentState();
116 fprintf( stderr, "\n" );116 fprintf( stderr, "\n" );
117 #endif117 #endif
@@ -152,7 +152,7 @@
152 initOutBuff( newBuff, _outBuff.bufSize, _outBuffCapacityHint );152 initOutBuff( newBuff, _outBuff.bufSize, _outBuffCapacityHint );
153153
154 #ifdef PBZIP_DEBUG154 #ifdef PBZIP_DEBUG
155 fprintf( stderr, " end ensureOutBuffCapacity/newSize=%u: [", newSize );155 fprintf( stderr, " end ensureOutBuffCapacity/newSize=%"PRIuMAX": [", (uintmax_t) newSize );
156 printCurrentState();156 printCurrentState();
157 fprintf( stderr, "\n" );157 fprintf( stderr, "\n" );
158 #endif158 #endif
@@ -486,19 +486,21 @@
486}486}
487487
488488
489#ifdef PBZIP_DEBUG
489void BZ2StreamScanner::printCurrentState()490void BZ2StreamScanner::printCurrentState()
490{491{
491 fprintf( stderr, "current=%d, search pos=%d, end pos=%d; s-c=%d"492 fprintf( stderr, "current=%ld, search pos=%ld, end pos=%ld; s-c=%ld"
492 "; out buf size=%d; out buf capacity=%d; header found=%d; search status=%d",493 "; out buf size=%d; out buf capacity=%d; header found=%d; search status=%d",
493 getInBuffCurrent() - getInBuffBegin(),494 (long)(getInBuffCurrent() - getInBuffBegin()),
494 getInBuffSearchPtr() - getInBuffBegin(),495 (long)(getInBuffSearchPtr() - getInBuffBegin()),
495 getInBuffEnd() - getInBuffBegin(),496 (long)(getInBuffEnd() - getInBuffBegin()),
496 getInBuffSearchPtr() - getInBuffCurrent(),497 (long)(getInBuffSearchPtr() - getInBuffCurrent()),
497 (int)_outBuff.bufSize,498 (int)_outBuff.bufSize,
498 (int)_outBuffCapacity,499 (int)_outBuffCapacity,
499 (int)isBz2HeaderFound(),500 (int)isBz2HeaderFound(),
500 (int)getSearchStatus() );501 (int)getSearchStatus() );
501}502}
503#endif
502504
503/**505/**
504 * Search next bz2 header. Read more data from file if needed.506 * Search next bz2 header. Read more data from file if needed.
@@ -510,8 +512,8 @@
510BZ2StreamScanner::CharType * BZ2StreamScanner::searchNextHeader()512BZ2StreamScanner::CharType * BZ2StreamScanner::searchNextHeader()
511{513{
512 #ifdef PBZIP_DEBUG514 #ifdef PBZIP_DEBUG
513 fprintf( stderr, " start searchNextHeader %u/%u... : ",515 fprintf( stderr, " start searchNextHeader %u/%"PRIuMAX"... : ",
514 getInBuffSearchPtr() - getInBuffBegin(), getInBuffSize() );516 (unsigned) (getInBuffSearchPtr() - getInBuffBegin()), (uintmax_t) getInBuffSize() );
515 printCurrentState();517 printCurrentState();
516 fprintf( stderr, "\n" );518 fprintf( stderr, "\n" );
517 #endif519 #endif
@@ -550,8 +552,8 @@
550 }552 }
551553
552 #ifdef PBZIP_DEBUG554 #ifdef PBZIP_DEBUG
553 fprintf( stderr, " end searchNextHeader %u/%u... NOT FOUND: ",555 fprintf( stderr, " end searchNextHeader %u/%"PRIuMAX"... NOT FOUND: ",
554 getInBuffSearchPtr() - getInBuffBegin(), getInBuffSize() );556 (unsigned) (getInBuffSearchPtr() - getInBuffBegin()), (uintmax_t) getInBuffSize() );
555 printCurrentState();557 printCurrentState();
556 fprintf( stderr, "\n" );558 fprintf( stderr, "\n" );
557 #endif559 #endif
@@ -678,8 +680,8 @@
678 OFF_T startBlock = blockNum;680 OFF_T startBlock = blockNum;
679 blockNum += _outBuff.bufSize;681 blockNum += _outBuff.bufSize;
680682
681 fprintf( stderr, " end getNextStream/blockRange=[%"PRIu64", %"PRIu64"), stream no=%d; seq=%d: [",683 fprintf( stderr, " end getNextStream/blockRange=[%"PRIuMAX", %"PRIuMAX"), stream no=%d; seq=%d: [",
682 startBlock, blockNum, _outBuff.blockNumber, _outBuff.sequenceNumber );684 (uintmax_t) startBlock, (uintmax_t) blockNum, _outBuff.blockNumber, _outBuff.sequenceNumber );
683 printCurrentState();685 printCurrentState();
684 fprintf( stderr, "\n" );686 fprintf( stderr, "\n" );
685 #endif687 #endif
686688
=== modified file 'BZ2StreamScanner.h'
--- BZ2StreamScanner.h 2011-02-12 13:35:21 +0000
+++ BZ2StreamScanner.h 2014-04-13 13:56:00 +0000
@@ -66,7 +66,9 @@
66 */66 */
67 virtual void dispose();67 virtual void dispose();
6868
69 #ifdef PBZIP_DEBUG
69 void printCurrentState();70 void printCurrentState();
71 #endif
70 72
71private:73private:
72 /* disable copy c-tor */74 /* disable copy c-tor */
7375
=== modified file 'ChangeLog'
--- ChangeLog 2014-04-11 19:43:25 +0000
+++ ChangeLog 2014-04-13 13:56:00 +0000
@@ -3,6 +3,7 @@
3- Makefile refinements3- Makefile refinements
4- close redirected stdout on finish for better AFS/NFS support (bug #1300876)4- close redirected stdout on finish for better AFS/NFS support (bug #1300876)
5 Thanks to Richard Brittain 5 Thanks to Richard Brittain
6- Fix printf format vs actual type misalignments (#1236086)
6Changes in 1.1.8 (Jun 10, 2012)7Changes in 1.1.8 (Jun 10, 2012)
7- Fix of metadata unpreserved on empty files compress (bug #1011021)8- Fix of metadata unpreserved on empty files compress (bug #1011021)
8Changes in 1.1.7 (Dec 11, 2011)9Changes in 1.1.7 (Dec 11, 2011)
910
=== modified file 'pbzip2.cpp'
--- pbzip2.cpp 2014-04-11 19:36:32 +0000
+++ pbzip2.cpp 2014-04-13 13:56:00 +0000
@@ -513,8 +513,8 @@
513 waitTimer.tv_sec += seconds;513 waitTimer.tv_sec += seconds;
514 #endif514 #endif
515 #ifdef PBZIP_DEBUG515 #ifdef PBZIP_DEBUG
516 fprintf(stderr, "%s: waitTimer.tv_sec: %d waitTimer.tv_nsec: %lld\n", caller, waitTimer.tv_sec,516 fprintf(stderr, "%s: waitTimer.tv_sec: %"PRIiMAX" waitTimer.tv_nsec: %"PRIiMAX"\n", caller,
517 (long long)waitTimer.tv_nsec);517 (intmax_t)waitTimer.tv_sec, (intmax_t)waitTimer.tv_nsec);
518 #endif518 #endif
519 int pret = pthread_cond_timedwait(cond, mutex, &waitTimer);519 int pret = pthread_cond_timedwait(cond, mutex, &waitTimer);
520 // we are not using a compatible pthreads library so abort520 // we are not using a compatible pthreads library so abort
@@ -814,8 +814,8 @@
814 814
815 safe_mutex_lock(OutMutex);815 safe_mutex_lock(OutMutex);
816 #ifdef PBZIP_DEBUG816 #ifdef PBZIP_DEBUG
817 unsigned long long thid = (unsigned long long) pthread_self();817 uintmax_t thid = (uintmax_t) pthread_self();
818 fprintf(stderr, "(%"PRIu64") syncSetLastGoodBlock: %d -> %d; MinErrorBlock: %d -> %d\n",818 fprintf(stderr, "(%"PRIuMAX") syncSetLastGoodBlock: %d -> %d; MinErrorBlock: %d -> %d\n",
819 thid, LastGoodBlock, newValue, MinErrorBlock, errBlock);819 thid, LastGoodBlock, newValue, MinErrorBlock, errBlock);
820 #endif820 #endif
821821
@@ -920,9 +920,9 @@
920int waitForPreviousBlock(int blockNumToWait, int errBlockNumber)920int waitForPreviousBlock(int blockNumToWait, int errBlockNumber)
921{921{
922 #ifdef PBZIP_DEBUG922 #ifdef PBZIP_DEBUG
923 unsigned long long thid = (unsigned long long) pthread_self();923 uintmax_t thid = (uintmax_t) pthread_self();
924 safe_mutex_lock(OutMutex);924 safe_mutex_lock(OutMutex);
925 fprintf( stderr, "(%"PRIu64") waitForPreviousBlock enter: LastGoodBlock=%d"925 fprintf( stderr, "(%"PRIuMAX") waitForPreviousBlock enter: LastGoodBlock=%d"
926 "; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d; errBlockNumber=%d\n",926 "; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d; errBlockNumber=%d\n",
927 thid,927 thid,
928 LastGoodBlock, blockNumToWait, NextBlockToWrite,928 LastGoodBlock, blockNumToWait, NextBlockToWrite,
@@ -935,7 +935,7 @@
935 if (syncGetTerminateFlag() != 0)935 if (syncGetTerminateFlag() != 0)
936 {936 {
937 #ifdef PBZIP_DEBUG937 #ifdef PBZIP_DEBUG
938 fprintf(stderr, "(%"PRIu64") waitForPreviousBlock terminated [%d]: blockNumToWait=%d\n",938 fprintf(stderr, "(%"PRIuMAX") waitForPreviousBlock terminated [%d]: blockNumToWait=%d\n",
939 thid, -1, blockNumToWait );939 thid, -1, blockNumToWait );
940 #endif940 #endif
941 return -1;941 return -1;
@@ -944,7 +944,7 @@
944 safe_mutex_lock(OutMutex);944 safe_mutex_lock(OutMutex);
945945
946 #ifdef PBZIP_DEBUG946 #ifdef PBZIP_DEBUG
947 fprintf( stderr, "(%"PRIu64") waitForPreviousBlock before check: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",947 fprintf( stderr, "(%"PRIuMAX") waitForPreviousBlock before check: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",
948 thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );948 thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );
949 #endif949 #endif
950950
@@ -952,7 +952,7 @@
952 if ( (MinErrorBlock != -1) && (MinErrorBlock < errBlockNumber) )952 if ( (MinErrorBlock != -1) && (MinErrorBlock < errBlockNumber) )
953 {953 {
954 #ifdef PBZIP_DEBUG954 #ifdef PBZIP_DEBUG
955 fprintf( stderr, "(%"PRIu64") waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",955 fprintf( stderr, "(%"PRIuMAX") waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",
956 thid, 2, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );956 thid, 2, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );
957 #endif957 #endif
958 safe_mutex_unlock(OutMutex);958 safe_mutex_unlock(OutMutex);
@@ -962,7 +962,7 @@
962 if (errBlockNumber <= NextBlockToWrite)962 if (errBlockNumber <= NextBlockToWrite)
963 {963 {
964 #ifdef PBZIP_DEBUG964 #ifdef PBZIP_DEBUG
965 fprintf( stderr, "(%"PRIu64") waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",965 fprintf( stderr, "(%"PRIuMAX") waitForPreviousBlock exit [%d]: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",
966 thid, 0, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );966 thid, 0, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );
967 #endif967 #endif
968 safe_mutex_unlock(OutMutex);968 safe_mutex_unlock(OutMutex);
@@ -970,7 +970,7 @@
970 }970 }
971971
972 #ifdef PBZIP_DEBUG972 #ifdef PBZIP_DEBUG
973 fprintf( stderr, "(%"PRIu64") waitForPreviousBlock to sleep: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",973 fprintf( stderr, "(%"PRIuMAX") waitForPreviousBlock to sleep: LastGoodBlock=%d; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d\n",
974 thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );974 thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock );
975 #endif975 #endif
976976
@@ -1018,8 +1018,8 @@
1018 int exitCode)1018 int exitCode)
1019{1019{
1020 #ifdef PBZIP_DEBUG1020 #ifdef PBZIP_DEBUG
1021 unsigned long long thid = (unsigned long long) pthread_self();1021 uintmax_t thid = (uintmax_t) pthread_self();
1022 fprintf(stderr, "(%"PRIu64") enter issueDecompressError: msg=%s; ret=%d; block=%d; seq=%d; isLastInSeq=%d; avail_in=%d\n",1022 fprintf(stderr, "(%"PRIuMAX") enter issueDecompressError: msg=%s; ret=%d; block=%d; seq=%d; isLastInSeq=%d; avail_in=%d\n",
1023 thid,1023 thid,
1024 errmsg, bzret, fileData->blockNumber,1024 errmsg, bzret, fileData->blockNumber,
1025 outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in);1025 outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in);
@@ -1054,8 +1054,8 @@
1054 int lastGoodBlock = getLastGoodBlockBeforeErr(fileData->blockNumber, outSequenceNumber);1054 int lastGoodBlock = getLastGoodBlockBeforeErr(fileData->blockNumber, outSequenceNumber);
10551055
1056 #ifdef PBZIP_DEBUG1056 #ifdef PBZIP_DEBUG
1057 unsigned long long thid = (unsigned long long) pthread_self();1057 uintmax_t thid = (uintmax_t) pthread_self();
1058 fprintf(stderr, "(%"PRIu64") enter decompressErrCheckSingle: msg=%s; ret=%d; block=%d; seq=%d; isLastInSeq=%d; avail_in=%d; lastGoodBlock=%d\n",1058 fprintf(stderr, "(%"PRIuMAX") enter decompressErrCheckSingle: msg=%s; ret=%d; block=%d; seq=%d; isLastInSeq=%d; avail_in=%d; lastGoodBlock=%d\n",
1059 thid,1059 thid,
1060 errmsg, bzret, fileData->blockNumber,1060 errmsg, bzret, fileData->blockNumber,
1061 outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in, lastGoodBlock);1061 outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in, lastGoodBlock);
@@ -1480,8 +1480,8 @@
1480 // give warning to user if block is larger than 250 million bytes1480 // give warning to user if block is larger than 250 million bytes
1481 if (fileData->bufSize > 250000000)1481 if (fileData->bufSize > 250000000)
1482 {1482 {
1483 fprintf(stderr, "pbzip2: *WARNING: Compressed block size is large [%"PRIu64" bytes].\n",1483 fprintf(stderr, "pbzip2: *WARNING: Compressed block size is large [%"PRIuMAX" bytes].\n",
1484 (unsigned long long) fileData->bufSize);1484 (uintmax_t) fileData->bufSize);
1485 fprintf(stderr, " If program aborts, use regular BZIP2 to decompress.\n");1485 fprintf(stderr, " If program aborts, use regular BZIP2 to decompress.\n");
1486 }1486 }
1487 }1487 }
@@ -1504,8 +1504,8 @@
1504 }1504 }
1505 }1505 }
1506 #ifdef PBZIP_DEBUG1506 #ifdef PBZIP_DEBUG
1507 fprintf(stderr, "producer: Buffer: %x Size: %"PRIu64" Block: %d\n", fileData->buf,1507 fprintf(stderr, "producer: Buffer: %p Size: %"PRIuMAX" Block: %d\n", fileData->buf,
1508 (unsigned long long)fileData->bufSize, NumBlocks);1508 (uintmax_t)fileData->bufSize, NumBlocks);
1509 #endif1509 #endif
15101510
1511 fifo->add(fileData);1511 fifo->add(fileData);
@@ -1561,7 +1561,7 @@
1561 bool isInterrupted = false;1561 bool isInterrupted = false;
15621562
1563 #ifdef PBZIP_DEBUG1563 #ifdef PBZIP_DEBUG
1564 unsigned long long thid = (unsigned long long) pthread_self();1564 uintmax_t thid = (uintmax_t) pthread_self();
1565 #endif1565 #endif
15661566
1567 if (syncGetTerminateFlag() != 0)1567 if (syncGetTerminateFlag() != 0)
@@ -1569,7 +1569,7 @@
1569 isInterrupted = true;1569 isInterrupted = true;
15701570
1571 #ifdef PBZIP_DEBUG1571 #ifdef PBZIP_DEBUG
1572 fprintf (stderr, "(%"PRIu64") consumer_decompress: interrupt1 - TerminateFlag set.\n", thid);1572 fprintf (stderr, "(%"PRIuMAX") consumer_decompress: interrupt1 - TerminateFlag set.\n", thid);
1573 #endif1573 #endif
1574 }1574 }
1575 int minErrBlock = syncGetMinErrorBlock();1575 int minErrBlock = syncGetMinErrorBlock();
@@ -1581,7 +1581,7 @@
1581 isInterrupted = true;1581 isInterrupted = true;
15821582
1583 #ifdef PBZIP_DEBUG1583 #ifdef PBZIP_DEBUG
1584 fprintf (stderr, "(%"PRIu64") consumer_decompress: terminating1 - LastGoodBlock set [%d].\n", thid, syncGetLastGoodBlock());1584 fprintf (stderr, "(%"PRIuMAX") consumer_decompress: terminating1 - LastGoodBlock set [%d].\n", thid, syncGetLastGoodBlock());
1585 #endif1585 #endif
1586 }1586 }
15871587
@@ -1669,8 +1669,8 @@
1669 }1669 }
1670 1670
1671 #ifdef PBZIP_DEBUG1671 #ifdef PBZIP_DEBUG
1672 fprintf(stderr, "consumer: FileData: %x\n", fileData);1672 fprintf(stderr, "consumer: FileData: %p\n", fileData);
1673 fprintf(stderr, "consumer: Buffer: %x Size: %u Block: %d\n",1673 fprintf(stderr, "consumer: Buffer: %p Size: %u Block: %d\n",
1674 fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber);1674 fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber);
1675 #endif1675 #endif
16761676
@@ -1838,7 +1838,7 @@
1838 disposeMemory(fileData->buf);1838 disposeMemory(fileData->buf);
18391839
1840 #ifdef PBZIP_DEBUG1840 #ifdef PBZIP_DEBUG
1841 fprintf(stderr, " OutputBuffer[%d].buf = %x\n", fileData->blockNumber, DecompressedData);1841 fprintf(stderr, " OutputBuffer[%d].buf = %p\n", fileData->blockNumber, DecompressedData);
1842 fprintf(stderr, " OutputBuffer[%d].bufSize = %u\n", fileData->blockNumber, outSize);1842 fprintf(stderr, " OutputBuffer[%d].bufSize = %u\n", fileData->blockNumber, outSize);
1843 fflush(stderr);1843 fflush(stderr);
1844 #endif1844 #endif
@@ -1925,13 +1925,13 @@
1925 safe_mutex_lock(OutMutex);1925 safe_mutex_lock(OutMutex);
1926 #ifdef PBZIP_DEBUG1926 #ifdef PBZIP_DEBUG
1927 outBuff * lastnext = (prevBlockInSequence != NULL) ? prevBlockInSequence->next : NULL;1927 outBuff * lastnext = (prevBlockInSequence != NULL) ? prevBlockInSequence->next : NULL;
1928 fprintf(stderr, "fileWriter: Block: %d Size: %u Next File Block: %d"1928 fprintf(stderr, "fileWriter: Block: %d Size: %"PRIuMAX" Next File Block: %d"
1929 ", outBufferPos: %u, NumBlocks: %d, producerDone: %d, lastseq=%d"1929 ", outBufferPos: %"PRIuMAX", NumBlocks: %d, producerDone: %d, lastseq=%d"
1930 ", prev=%llx, next=%llx\n",1930 ", prev=%p, next=%p\n",
1931 currBlock, NumBufferedBlocksMax, NextBlockToWrite,1931 currBlock, (uintmax_t)NumBufferedBlocksMax, NextBlockToWrite,
1932 outBufferPos, NumBlocks, syncGetProducerDone(), lastseq,1932 (uintmax_t)outBufferPos, NumBlocks, syncGetProducerDone(), lastseq,
1933 (unsigned long long)prevBlockInSequence,1933 prevBlockInSequence,
1934 (unsigned long long)lastnext);1934 lastnext);
1935 #endif1935 #endif
19361936
1937 if ( (LastGoodBlock != -1) && (NextBlockToWrite > LastGoodBlock) )1937 if ( (LastGoodBlock != -1) && (NextBlockToWrite > LastGoodBlock) )
@@ -1970,7 +1970,7 @@
1970 }1970 }
19711971
1972 #ifdef PBZIP_DEBUG1972 #ifdef PBZIP_DEBUG
1973 fprintf(stderr, "fileWriter: Buffer: %x Size: %u Block: %d, Seq: %d, isLast: %d\n",1973 fprintf(stderr, "fileWriter: Buffer: %p Size: %u Block: %d, Seq: %d, isLast: %d\n",
1974 OutputBuffer[outBufferPos].buf, OutputBuffer[outBufferPos].bufSize, currBlock,1974 OutputBuffer[outBufferPos].buf, OutputBuffer[outBufferPos].bufSize, currBlock,
1975 outBlock->sequenceNumber, (int)outBlock->isLastInSequence);1975 outBlock->sequenceNumber, (int)outBlock->isLastInSequence);
1976 #endif1976 #endif
@@ -2052,7 +2052,7 @@
2052 }2052 }
2053 2053
2054 #ifdef PBZIP_DEBUG2054 #ifdef PBZIP_DEBUG
2055 fprintf(stderr, "Completed: %d%% NextBlockToWrite: %d/%u \r", percentComplete, NextBlockToWrite, NumBufferedBlocksMax);2055 fprintf(stderr, "Completed: %d%% NextBlockToWrite: %d/%"PRIuMAX" \r", percentComplete, NextBlockToWrite, (uintmax_t)NumBufferedBlocksMax);
2056 fflush(stderr);2056 fflush(stderr);
2057 #else2057 #else
2058 if (percentComplete != percentCompleteOld)2058 if (percentComplete != percentCompleteOld)
@@ -2090,7 +2090,7 @@
2090 2090
2091 if (QuietMode != 1)2091 if (QuietMode != 1)
2092 {2092 {
2093 fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)CompressedSize);2093 fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize);
2094 }2094 }
20952095
2096 #ifdef PBZIP_DEBUG2096 #ifdef PBZIP_DEBUG
@@ -2116,7 +2116,7 @@
2116 percentComplete = 100;2116 percentComplete = 100;
21172117
2118 #ifdef PBZIP_DEBUG2118 #ifdef PBZIP_DEBUG
2119 fprintf(stderr, "Completed: %d%% NextBlockToWrite: %d/%u \r", percentComplete, NextBlockToWrite, NumBufferedBlocksMax);2119 fprintf(stderr, "Completed: %d%% NextBlockToWrite: %d/%"PRIuMAX" \r", percentComplete, NextBlockToWrite, (uintmax_t)NumBufferedBlocksMax);
2120 fflush(stderr);2120 fflush(stderr);
2121 #else2121 #else
21222122
@@ -2190,7 +2190,7 @@
2190 inSize = bytesLeft;2190 inSize = bytesLeft;
21912191
2192 #ifdef PBZIP_DEBUG2192 #ifdef PBZIP_DEBUG
2193 fprintf(stderr, " -> Bytes To Read: %"PRIu64" bytes...\n", inSize);2193 fprintf(stderr, " -> Bytes To Read: %"PRIuMAX" bytes...\n", (uintmax_t)inSize);
2194 #endif2194 #endif
21952195
2196 // allocate memory to read in file2196 // allocate memory to read in file
@@ -2267,7 +2267,7 @@
2267 }2267 }
22682268
2269 #ifdef PBZIP_DEBUG2269 #ifdef PBZIP_DEBUG
2270 fprintf(stderr, "\n Original Block Size: %u\n", inSize);2270 fprintf(stderr, "\n Original Block Size: %"PRIuMAX"\n", (uintmax_t)inSize);
2271 fprintf(stderr, " Compressed Block Size: %u\n", outSize);2271 fprintf(stderr, " Compressed Block Size: %u\n", outSize);
2272 #endif2272 #endif
22732273
@@ -2333,7 +2333,7 @@
2333 close(hOutfile);2333 close(hOutfile);
2334 if (QuietMode != 1)2334 if (QuietMode != 1)
2335 {2335 {
2336 fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)CompressedSize);2336 fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize);
2337 }2337 }
23382338
2339 syncSetProducerDone(1); // Not really needed for direct version2339 syncSetProducerDone(1); // Not really needed for direct version
@@ -2689,7 +2689,7 @@
2689 inSize = blockSize;2689 inSize = blockSize;
26902690
2691 #ifdef PBZIP_DEBUG2691 #ifdef PBZIP_DEBUG
2692 fprintf(stderr, " -> Bytes To Read: %"PRIu64" bytes...\n", inSize);2692 fprintf(stderr, " -> Bytes To Read: %"PRIuMAX" bytes...\n", (uintmax_t)inSize);
2693 #endif2693 #endif
26942694
2695 // allocate memory to read in file2695 // allocate memory to read in file
@@ -2750,7 +2750,7 @@
2750 }2750 }
2751 }2751 }
2752 #ifdef PBZIP_DEBUG2752 #ifdef PBZIP_DEBUG
2753 fprintf(stderr, "producer: Buffer: %x Size: %"PRIu64" Block: %d\n", FileData, inSize, NumBlocks);2753 fprintf(stderr, "producer: Buffer: %p Size: %"PRIuMAX" Block: %d\n", FileData, (uintmax_t)inSize, NumBlocks);
2754 #endif2754 #endif
27552755
2756 outBuff * queueElement = new(std::nothrow) outBuff(FileData, inSize, NumBlocks, 0);2756 outBuff * queueElement = new(std::nothrow) outBuff(FileData, inSize, NumBlocks, 0);
@@ -2843,7 +2843,7 @@
2843 }2843 }
28442844
2845 #ifdef PBZIP_DEBUG2845 #ifdef PBZIP_DEBUG
2846 fprintf(stderr, "consumer: Buffer: %x Size: %u Block: %d\n",2846 fprintf(stderr, "consumer: Buffer: %p Size: %u Block: %d\n",
2847 fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber);2847 fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber);
2848 #endif2848 #endif
28492849
@@ -3068,7 +3068,7 @@
3068 // unlikely to get here since more likely exception will be thrown3068 // unlikely to get here since more likely exception will be thrown
3069 if (OutputBuffer.size() != size)3069 if (OutputBuffer.size() != size)
3070 {3070 {
3071 fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%u! Aborting...\n", size);3071 fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%"PRIuMAX"! Aborting...\n", (uintmax_t)size);
3072 safe_mutex_unlock(OutMutex);3072 safe_mutex_unlock(OutMutex);
3073 exit(1);3073 exit(1);
3074 }3074 }
@@ -3762,7 +3762,7 @@
3762 continue;3762 continue;
3763 }3763 }
3764 #ifdef PBZIP_DEBUG3764 #ifdef PBZIP_DEBUG
3765 fprintf(stderr, "argv[%u]: %s Len: %d\n", i, argv[i], strlen(argv[i]));3765 fprintf(stderr, "argv[%u]: %s Len: %d\n", (unsigned)i, argv[i], (int)strlen(argv[i]));
3766 #endif3766 #endif
3767 // get command line options with single "-"3767 // get command line options with single "-"
3768 // check for multiple switches grouped together3768 // check for multiple switches grouped together
@@ -3997,11 +3997,11 @@
39973997
3998 // do sanity check to make sure integers are the size we expect3998 // do sanity check to make sure integers are the size we expect
3999 #ifdef PBZIP_DEBUG3999 #ifdef PBZIP_DEBUG
4000 fprintf(stderr, "off_t size: %u uint size: %u\n", sizeof(OFF_T), sizeof(unsigned int));4000 fprintf(stderr, "off_t size: %u uint size: %u\n", (unsigned)sizeof(OFF_T), (unsigned)sizeof(unsigned int));
4001 #endif4001 #endif
4002 if (sizeof(OFF_T) <= 4)4002 if (sizeof(OFF_T) <= 4)
4003 {4003 {
4004 fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %u bits!\n", sizeof(OFF_T)*CHAR_BIT);4004 fprintf(stderr, "\npbzip2: *WARNING: off_t variable size only %u bits!\n", (unsigned)(sizeof(OFF_T)*CHAR_BIT));
4005 if (decompress == 1)4005 if (decompress == 1)
4006 fprintf(stderr, " You will only able to uncompress files smaller than 2GB in size.\n\n");4006 fprintf(stderr, " You will only able to uncompress files smaller than 2GB in size.\n\n");
4007 else4007 else
@@ -4370,7 +4370,7 @@
4370 if (decompress == 1)4370 if (decompress == 1)
4371 fprintf(stderr, " BWT Block Size: %c00k\n", BWTblockSizeChar);4371 fprintf(stderr, " BWT Block Size: %c00k\n", BWTblockSizeChar);
4372 if (strcmp(InFilename, "-") != 0) 4372 if (strcmp(InFilename, "-") != 0)
4373 fprintf(stderr, " Input Size: %"PRIu64" bytes\n", (unsigned long long)InFileSize);4373 fprintf(stderr, " Input Size: %"PRIuMAX" bytes\n", (uintmax_t)InFileSize);
4374 }4374 }
43754375
4376 if (decompress == 1)4376 if (decompress == 1)
@@ -4445,7 +4445,7 @@
4445 }4445 }
4446 if (QuietMode != 1)4446 if (QuietMode != 1)
4447 {4447 {
4448 fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)sizeof(Bz2HeaderZero));4448 fprintf(stderr, " Output Size: %u bytes\n", (unsigned)sizeof(Bz2HeaderZero));
4449 fprintf(stderr, "-------------------------------------------\n");4449 fprintf(stderr, "-------------------------------------------\n");
4450 }4450 }
4451 // remove input file unless requested not to by user or error occurred4451 // remove input file unless requested not to by user or error occurred
@@ -4482,7 +4482,7 @@
4482 NumBufferedBlocksMax = NumBufferedBlocksMax - (numCPU * 2);4482 NumBufferedBlocksMax = NumBufferedBlocksMax - (numCPU * 2);
4483 #ifdef PBZIP_DEBUG4483 #ifdef PBZIP_DEBUG
4484 fprintf(stderr, "pbzip2: maxMemory: %d blockSize: %d\n", maxMemory, blockSize);4484 fprintf(stderr, "pbzip2: maxMemory: %d blockSize: %d\n", maxMemory, blockSize);
4485 fprintf(stderr, "pbzip2: NumBufferedBlocksMax: %u\n", NumBufferedBlocksMax);4485 fprintf(stderr, "pbzip2: NumBufferedBlocksMax: %"PRIuMAX"\n", (uintmax_t)NumBufferedBlocksMax);
4486 #endif4486 #endif
4487 // check to see if our max buffered blocks is less than numCPU, if yes increase maxMemory4487 // check to see if our max buffered blocks is less than numCPU, if yes increase maxMemory
4488 // to support numCPU requested unless -m switch given by user4488 // to support numCPU requested unless -m switch given by user
@@ -4492,7 +4492,7 @@
4492 {4492 {
4493 NumBufferedBlocksMax = numCPU;4493 NumBufferedBlocksMax = numCPU;
4494 if (QuietMode != 1)4494 if (QuietMode != 1)
4495 fprintf(stderr, "*Warning* Max memory limit increased to %d MB to support %d CPUs\n", ((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);4495 fprintf(stderr, "*Warning* Max memory limit increased to %"PRIuMAX" MB to support %d CPUs\n", (uintmax_t)((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
4496 }4496 }
4497 else4497 else
4498 {4498 {
44994499
=== modified file 'pbzip2.h'
--- pbzip2.h 2011-07-11 21:22:50 +0000
+++ pbzip2.h 2014-04-13 13:56:00 +0000
@@ -53,6 +53,9 @@
5353
54#include <stdio.h>54#include <stdio.h>
55#include <pthread.h>55#include <pthread.h>
56
57#define __STDC_FORMAT_MACROS
58#include <inttypes.h>
56}59}
5760
58// uncomment for debug output61// uncomment for debug output

Subscribers

People subscribed via source and target branches