Merge lp:~yavor-nikolov/pbzip2/bug-1236086-printf-numeric-type-alignment into lp:pbzip2/1.1
- bug-1236086-printf-numeric-type-alignment
- Merge into 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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Yavor Nikolov | Approve | ||
Review via email: mp+215574@code.launchpad.net |
Commit message
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
1 | === modified file 'BZ2StreamScanner.cpp' | |||
2 | --- BZ2StreamScanner.cpp 2011-02-12 13:35:21 +0000 | |||
3 | +++ BZ2StreamScanner.cpp 2014-04-13 13:56:00 +0000 | |||
4 | @@ -111,7 +111,7 @@ | |||
5 | 111 | int BZ2StreamScanner::ensureOutBuffCapacity( size_t newSize ) | 111 | int BZ2StreamScanner::ensureOutBuffCapacity( size_t newSize ) |
6 | 112 | { | 112 | { |
7 | 113 | #ifdef PBZIP_DEBUG | 113 | #ifdef PBZIP_DEBUG |
9 | 114 | fprintf( stderr, " start ensureOutBuffCapacity/newSize=%u: [", newSize ); | 114 | fprintf( stderr, " start ensureOutBuffCapacity/newSize=%"PRIuMAX": [", (uintmax_t) newSize ); |
10 | 115 | printCurrentState(); | 115 | printCurrentState(); |
11 | 116 | fprintf( stderr, "\n" ); | 116 | fprintf( stderr, "\n" ); |
12 | 117 | #endif | 117 | #endif |
13 | @@ -152,7 +152,7 @@ | |||
14 | 152 | initOutBuff( newBuff, _outBuff.bufSize, _outBuffCapacityHint ); | 152 | initOutBuff( newBuff, _outBuff.bufSize, _outBuffCapacityHint ); |
15 | 153 | 153 | ||
16 | 154 | #ifdef PBZIP_DEBUG | 154 | #ifdef PBZIP_DEBUG |
18 | 155 | fprintf( stderr, " end ensureOutBuffCapacity/newSize=%u: [", newSize ); | 155 | fprintf( stderr, " end ensureOutBuffCapacity/newSize=%"PRIuMAX": [", (uintmax_t) newSize ); |
19 | 156 | printCurrentState(); | 156 | printCurrentState(); |
20 | 157 | fprintf( stderr, "\n" ); | 157 | fprintf( stderr, "\n" ); |
21 | 158 | #endif | 158 | #endif |
22 | @@ -486,19 +486,21 @@ | |||
23 | 486 | } | 486 | } |
24 | 487 | 487 | ||
25 | 488 | 488 | ||
26 | 489 | #ifdef PBZIP_DEBUG | ||
27 | 489 | void BZ2StreamScanner::printCurrentState() | 490 | void BZ2StreamScanner::printCurrentState() |
28 | 490 | { | 491 | { |
30 | 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" |
31 | 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", |
36 | 493 | getInBuffCurrent() - getInBuffBegin(), | 494 | (long)(getInBuffCurrent() - getInBuffBegin()), |
37 | 494 | getInBuffSearchPtr() - getInBuffBegin(), | 495 | (long)(getInBuffSearchPtr() - getInBuffBegin()), |
38 | 495 | getInBuffEnd() - getInBuffBegin(), | 496 | (long)(getInBuffEnd() - getInBuffBegin()), |
39 | 496 | getInBuffSearchPtr() - getInBuffCurrent(), | 497 | (long)(getInBuffSearchPtr() - getInBuffCurrent()), |
40 | 497 | (int)_outBuff.bufSize, | 498 | (int)_outBuff.bufSize, |
41 | 498 | (int)_outBuffCapacity, | 499 | (int)_outBuffCapacity, |
42 | 499 | (int)isBz2HeaderFound(), | 500 | (int)isBz2HeaderFound(), |
43 | 500 | (int)getSearchStatus() ); | 501 | (int)getSearchStatus() ); |
44 | 501 | } | 502 | } |
45 | 503 | #endif | ||
46 | 502 | 504 | ||
47 | 503 | /** | 505 | /** |
48 | 504 | * Search next bz2 header. Read more data from file if needed. | 506 | * Search next bz2 header. Read more data from file if needed. |
49 | @@ -510,8 +512,8 @@ | |||
50 | 510 | BZ2StreamScanner::CharType * BZ2StreamScanner::searchNextHeader() | 512 | BZ2StreamScanner::CharType * BZ2StreamScanner::searchNextHeader() |
51 | 511 | { | 513 | { |
52 | 512 | #ifdef PBZIP_DEBUG | 514 | #ifdef PBZIP_DEBUG |
55 | 513 | fprintf( stderr, " start searchNextHeader %u/%u... : ", | 515 | fprintf( stderr, " start searchNextHeader %u/%"PRIuMAX"... : ", |
56 | 514 | getInBuffSearchPtr() - getInBuffBegin(), getInBuffSize() ); | 516 | (unsigned) (getInBuffSearchPtr() - getInBuffBegin()), (uintmax_t) getInBuffSize() ); |
57 | 515 | printCurrentState(); | 517 | printCurrentState(); |
58 | 516 | fprintf( stderr, "\n" ); | 518 | fprintf( stderr, "\n" ); |
59 | 517 | #endif | 519 | #endif |
60 | @@ -550,8 +552,8 @@ | |||
61 | 550 | } | 552 | } |
62 | 551 | 553 | ||
63 | 552 | #ifdef PBZIP_DEBUG | 554 | #ifdef PBZIP_DEBUG |
66 | 553 | fprintf( stderr, " end searchNextHeader %u/%u... NOT FOUND: ", | 555 | fprintf( stderr, " end searchNextHeader %u/%"PRIuMAX"... NOT FOUND: ", |
67 | 554 | getInBuffSearchPtr() - getInBuffBegin(), getInBuffSize() ); | 556 | (unsigned) (getInBuffSearchPtr() - getInBuffBegin()), (uintmax_t) getInBuffSize() ); |
68 | 555 | printCurrentState(); | 557 | printCurrentState(); |
69 | 556 | fprintf( stderr, "\n" ); | 558 | fprintf( stderr, "\n" ); |
70 | 557 | #endif | 559 | #endif |
71 | @@ -678,8 +680,8 @@ | |||
72 | 678 | OFF_T startBlock = blockNum; | 680 | OFF_T startBlock = blockNum; |
73 | 679 | blockNum += _outBuff.bufSize; | 681 | blockNum += _outBuff.bufSize; |
74 | 680 | 682 | ||
77 | 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: [", |
78 | 682 | startBlock, blockNum, _outBuff.blockNumber, _outBuff.sequenceNumber ); | 684 | (uintmax_t) startBlock, (uintmax_t) blockNum, _outBuff.blockNumber, _outBuff.sequenceNumber ); |
79 | 683 | printCurrentState(); | 685 | printCurrentState(); |
80 | 684 | fprintf( stderr, "\n" ); | 686 | fprintf( stderr, "\n" ); |
81 | 685 | #endif | 687 | #endif |
82 | 686 | 688 | ||
83 | === modified file 'BZ2StreamScanner.h' | |||
84 | --- BZ2StreamScanner.h 2011-02-12 13:35:21 +0000 | |||
85 | +++ BZ2StreamScanner.h 2014-04-13 13:56:00 +0000 | |||
86 | @@ -66,7 +66,9 @@ | |||
87 | 66 | */ | 66 | */ |
88 | 67 | virtual void dispose(); | 67 | virtual void dispose(); |
89 | 68 | 68 | ||
90 | 69 | #ifdef PBZIP_DEBUG | ||
91 | 69 | void printCurrentState(); | 70 | void printCurrentState(); |
92 | 71 | #endif | ||
93 | 70 | 72 | ||
94 | 71 | private: | 73 | private: |
95 | 72 | /* disable copy c-tor */ | 74 | /* disable copy c-tor */ |
96 | 73 | 75 | ||
97 | === modified file 'ChangeLog' | |||
98 | --- ChangeLog 2014-04-11 19:43:25 +0000 | |||
99 | +++ ChangeLog 2014-04-13 13:56:00 +0000 | |||
100 | @@ -3,6 +3,7 @@ | |||
101 | 3 | - Makefile refinements | 3 | - Makefile refinements |
102 | 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) |
103 | 5 | Thanks to Richard Brittain | 5 | Thanks to Richard Brittain |
104 | 6 | - Fix printf format vs actual type misalignments (#1236086) | ||
105 | 6 | Changes in 1.1.8 (Jun 10, 2012) | 7 | Changes in 1.1.8 (Jun 10, 2012) |
106 | 7 | - Fix of metadata unpreserved on empty files compress (bug #1011021) | 8 | - Fix of metadata unpreserved on empty files compress (bug #1011021) |
107 | 8 | Changes in 1.1.7 (Dec 11, 2011) | 9 | Changes in 1.1.7 (Dec 11, 2011) |
108 | 9 | 10 | ||
109 | === modified file 'pbzip2.cpp' | |||
110 | --- pbzip2.cpp 2014-04-11 19:36:32 +0000 | |||
111 | +++ pbzip2.cpp 2014-04-13 13:56:00 +0000 | |||
112 | @@ -513,8 +513,8 @@ | |||
113 | 513 | waitTimer.tv_sec += seconds; | 513 | waitTimer.tv_sec += seconds; |
114 | 514 | #endif | 514 | #endif |
115 | 515 | #ifdef PBZIP_DEBUG | 515 | #ifdef PBZIP_DEBUG |
118 | 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, |
119 | 517 | (long long)waitTimer.tv_nsec); | 517 | (intmax_t)waitTimer.tv_sec, (intmax_t)waitTimer.tv_nsec); |
120 | 518 | #endif | 518 | #endif |
121 | 519 | int pret = pthread_cond_timedwait(cond, mutex, &waitTimer); | 519 | int pret = pthread_cond_timedwait(cond, mutex, &waitTimer); |
122 | 520 | // we are not using a compatible pthreads library so abort | 520 | // we are not using a compatible pthreads library so abort |
123 | @@ -814,8 +814,8 @@ | |||
124 | 814 | 814 | ||
125 | 815 | safe_mutex_lock(OutMutex); | 815 | safe_mutex_lock(OutMutex); |
126 | 816 | #ifdef PBZIP_DEBUG | 816 | #ifdef PBZIP_DEBUG |
129 | 817 | unsigned long long thid = (unsigned long long) pthread_self(); | 817 | uintmax_t thid = (uintmax_t) pthread_self(); |
130 | 818 | fprintf(stderr, "(%"PRIu64") syncSetLastGoodBlock: %d -> %d; MinErrorBlock: %d -> %d\n", | 818 | fprintf(stderr, "(%"PRIuMAX") syncSetLastGoodBlock: %d -> %d; MinErrorBlock: %d -> %d\n", |
131 | 819 | thid, LastGoodBlock, newValue, MinErrorBlock, errBlock); | 819 | thid, LastGoodBlock, newValue, MinErrorBlock, errBlock); |
132 | 820 | #endif | 820 | #endif |
133 | 821 | 821 | ||
134 | @@ -920,9 +920,9 @@ | |||
135 | 920 | int waitForPreviousBlock(int blockNumToWait, int errBlockNumber) | 920 | int waitForPreviousBlock(int blockNumToWait, int errBlockNumber) |
136 | 921 | { | 921 | { |
137 | 922 | #ifdef PBZIP_DEBUG | 922 | #ifdef PBZIP_DEBUG |
139 | 923 | unsigned long long thid = (unsigned long long) pthread_self(); | 923 | uintmax_t thid = (uintmax_t) pthread_self(); |
140 | 924 | safe_mutex_lock(OutMutex); | 924 | safe_mutex_lock(OutMutex); |
142 | 925 | fprintf( stderr, "(%"PRIu64") waitForPreviousBlock enter: LastGoodBlock=%d" | 925 | fprintf( stderr, "(%"PRIuMAX") waitForPreviousBlock enter: LastGoodBlock=%d" |
143 | 926 | "; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d; errBlockNumber=%d\n", | 926 | "; blockNumToWait=%d; NextBlockToWrite=%d; MinErrorBlock=%d; errBlockNumber=%d\n", |
144 | 927 | thid, | 927 | thid, |
145 | 928 | LastGoodBlock, blockNumToWait, NextBlockToWrite, | 928 | LastGoodBlock, blockNumToWait, NextBlockToWrite, |
146 | @@ -935,7 +935,7 @@ | |||
147 | 935 | if (syncGetTerminateFlag() != 0) | 935 | if (syncGetTerminateFlag() != 0) |
148 | 936 | { | 936 | { |
149 | 937 | #ifdef PBZIP_DEBUG | 937 | #ifdef PBZIP_DEBUG |
151 | 938 | fprintf(stderr, "(%"PRIu64") waitForPreviousBlock terminated [%d]: blockNumToWait=%d\n", | 938 | fprintf(stderr, "(%"PRIuMAX") waitForPreviousBlock terminated [%d]: blockNumToWait=%d\n", |
152 | 939 | thid, -1, blockNumToWait ); | 939 | thid, -1, blockNumToWait ); |
153 | 940 | #endif | 940 | #endif |
154 | 941 | return -1; | 941 | return -1; |
155 | @@ -944,7 +944,7 @@ | |||
156 | 944 | safe_mutex_lock(OutMutex); | 944 | safe_mutex_lock(OutMutex); |
157 | 945 | 945 | ||
158 | 946 | #ifdef PBZIP_DEBUG | 946 | #ifdef PBZIP_DEBUG |
160 | 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", |
161 | 948 | thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); | 948 | thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); |
162 | 949 | #endif | 949 | #endif |
163 | 950 | 950 | ||
164 | @@ -952,7 +952,7 @@ | |||
165 | 952 | if ( (MinErrorBlock != -1) && (MinErrorBlock < errBlockNumber) ) | 952 | if ( (MinErrorBlock != -1) && (MinErrorBlock < errBlockNumber) ) |
166 | 953 | { | 953 | { |
167 | 954 | #ifdef PBZIP_DEBUG | 954 | #ifdef PBZIP_DEBUG |
169 | 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", |
170 | 956 | thid, 2, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); | 956 | thid, 2, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); |
171 | 957 | #endif | 957 | #endif |
172 | 958 | safe_mutex_unlock(OutMutex); | 958 | safe_mutex_unlock(OutMutex); |
173 | @@ -962,7 +962,7 @@ | |||
174 | 962 | if (errBlockNumber <= NextBlockToWrite) | 962 | if (errBlockNumber <= NextBlockToWrite) |
175 | 963 | { | 963 | { |
176 | 964 | #ifdef PBZIP_DEBUG | 964 | #ifdef PBZIP_DEBUG |
178 | 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", |
179 | 966 | thid, 0, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); | 966 | thid, 0, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); |
180 | 967 | #endif | 967 | #endif |
181 | 968 | safe_mutex_unlock(OutMutex); | 968 | safe_mutex_unlock(OutMutex); |
182 | @@ -970,7 +970,7 @@ | |||
183 | 970 | } | 970 | } |
184 | 971 | 971 | ||
185 | 972 | #ifdef PBZIP_DEBUG | 972 | #ifdef PBZIP_DEBUG |
187 | 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", |
188 | 974 | thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); | 974 | thid, LastGoodBlock, blockNumToWait, NextBlockToWrite, MinErrorBlock ); |
189 | 975 | #endif | 975 | #endif |
190 | 976 | 976 | ||
191 | @@ -1018,8 +1018,8 @@ | |||
192 | 1018 | int exitCode) | 1018 | int exitCode) |
193 | 1019 | { | 1019 | { |
194 | 1020 | #ifdef PBZIP_DEBUG | 1020 | #ifdef PBZIP_DEBUG |
197 | 1021 | unsigned long long thid = (unsigned long long) pthread_self(); | 1021 | uintmax_t thid = (uintmax_t) pthread_self(); |
198 | 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", |
199 | 1023 | thid, | 1023 | thid, |
200 | 1024 | errmsg, bzret, fileData->blockNumber, | 1024 | errmsg, bzret, fileData->blockNumber, |
201 | 1025 | outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in); | 1025 | outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in); |
202 | @@ -1054,8 +1054,8 @@ | |||
203 | 1054 | int lastGoodBlock = getLastGoodBlockBeforeErr(fileData->blockNumber, outSequenceNumber); | 1054 | int lastGoodBlock = getLastGoodBlockBeforeErr(fileData->blockNumber, outSequenceNumber); |
204 | 1055 | 1055 | ||
205 | 1056 | #ifdef PBZIP_DEBUG | 1056 | #ifdef PBZIP_DEBUG |
208 | 1057 | unsigned long long thid = (unsigned long long) pthread_self(); | 1057 | uintmax_t thid = (uintmax_t) pthread_self(); |
209 | 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", |
210 | 1059 | thid, | 1059 | thid, |
211 | 1060 | errmsg, bzret, fileData->blockNumber, | 1060 | errmsg, bzret, fileData->blockNumber, |
212 | 1061 | outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in, lastGoodBlock); | 1061 | outSequenceNumber, (int)fileData->isLastInSequence, strm.avail_in, lastGoodBlock); |
213 | @@ -1480,8 +1480,8 @@ | |||
214 | 1480 | // give warning to user if block is larger than 250 million bytes | 1480 | // give warning to user if block is larger than 250 million bytes |
215 | 1481 | if (fileData->bufSize > 250000000) | 1481 | if (fileData->bufSize > 250000000) |
216 | 1482 | { | 1482 | { |
219 | 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", |
220 | 1484 | (unsigned long long) fileData->bufSize); | 1484 | (uintmax_t) fileData->bufSize); |
221 | 1485 | fprintf(stderr, " If program aborts, use regular BZIP2 to decompress.\n"); | 1485 | fprintf(stderr, " If program aborts, use regular BZIP2 to decompress.\n"); |
222 | 1486 | } | 1486 | } |
223 | 1487 | } | 1487 | } |
224 | @@ -1504,8 +1504,8 @@ | |||
225 | 1504 | } | 1504 | } |
226 | 1505 | } | 1505 | } |
227 | 1506 | #ifdef PBZIP_DEBUG | 1506 | #ifdef PBZIP_DEBUG |
230 | 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, |
231 | 1508 | (unsigned long long)fileData->bufSize, NumBlocks); | 1508 | (uintmax_t)fileData->bufSize, NumBlocks); |
232 | 1509 | #endif | 1509 | #endif |
233 | 1510 | 1510 | ||
234 | 1511 | fifo->add(fileData); | 1511 | fifo->add(fileData); |
235 | @@ -1561,7 +1561,7 @@ | |||
236 | 1561 | bool isInterrupted = false; | 1561 | bool isInterrupted = false; |
237 | 1562 | 1562 | ||
238 | 1563 | #ifdef PBZIP_DEBUG | 1563 | #ifdef PBZIP_DEBUG |
240 | 1564 | unsigned long long thid = (unsigned long long) pthread_self(); | 1564 | uintmax_t thid = (uintmax_t) pthread_self(); |
241 | 1565 | #endif | 1565 | #endif |
242 | 1566 | 1566 | ||
243 | 1567 | if (syncGetTerminateFlag() != 0) | 1567 | if (syncGetTerminateFlag() != 0) |
244 | @@ -1569,7 +1569,7 @@ | |||
245 | 1569 | isInterrupted = true; | 1569 | isInterrupted = true; |
246 | 1570 | 1570 | ||
247 | 1571 | #ifdef PBZIP_DEBUG | 1571 | #ifdef PBZIP_DEBUG |
249 | 1572 | fprintf (stderr, "(%"PRIu64") consumer_decompress: interrupt1 - TerminateFlag set.\n", thid); | 1572 | fprintf (stderr, "(%"PRIuMAX") consumer_decompress: interrupt1 - TerminateFlag set.\n", thid); |
250 | 1573 | #endif | 1573 | #endif |
251 | 1574 | } | 1574 | } |
252 | 1575 | int minErrBlock = syncGetMinErrorBlock(); | 1575 | int minErrBlock = syncGetMinErrorBlock(); |
253 | @@ -1581,7 +1581,7 @@ | |||
254 | 1581 | isInterrupted = true; | 1581 | isInterrupted = true; |
255 | 1582 | 1582 | ||
256 | 1583 | #ifdef PBZIP_DEBUG | 1583 | #ifdef PBZIP_DEBUG |
258 | 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()); |
259 | 1585 | #endif | 1585 | #endif |
260 | 1586 | } | 1586 | } |
261 | 1587 | 1587 | ||
262 | @@ -1669,8 +1669,8 @@ | |||
263 | 1669 | } | 1669 | } |
264 | 1670 | 1670 | ||
265 | 1671 | #ifdef PBZIP_DEBUG | 1671 | #ifdef PBZIP_DEBUG |
268 | 1672 | fprintf(stderr, "consumer: FileData: %x\n", fileData); | 1672 | fprintf(stderr, "consumer: FileData: %p\n", fileData); |
269 | 1673 | fprintf(stderr, "consumer: Buffer: %x Size: %u Block: %d\n", | 1673 | fprintf(stderr, "consumer: Buffer: %p Size: %u Block: %d\n", |
270 | 1674 | fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber); | 1674 | fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber); |
271 | 1675 | #endif | 1675 | #endif |
272 | 1676 | 1676 | ||
273 | @@ -1838,7 +1838,7 @@ | |||
274 | 1838 | disposeMemory(fileData->buf); | 1838 | disposeMemory(fileData->buf); |
275 | 1839 | 1839 | ||
276 | 1840 | #ifdef PBZIP_DEBUG | 1840 | #ifdef PBZIP_DEBUG |
278 | 1841 | fprintf(stderr, " OutputBuffer[%d].buf = %x\n", fileData->blockNumber, DecompressedData); | 1841 | fprintf(stderr, " OutputBuffer[%d].buf = %p\n", fileData->blockNumber, DecompressedData); |
279 | 1842 | fprintf(stderr, " OutputBuffer[%d].bufSize = %u\n", fileData->blockNumber, outSize); | 1842 | fprintf(stderr, " OutputBuffer[%d].bufSize = %u\n", fileData->blockNumber, outSize); |
280 | 1843 | fflush(stderr); | 1843 | fflush(stderr); |
281 | 1844 | #endif | 1844 | #endif |
282 | @@ -1925,13 +1925,13 @@ | |||
283 | 1925 | safe_mutex_lock(OutMutex); | 1925 | safe_mutex_lock(OutMutex); |
284 | 1926 | #ifdef PBZIP_DEBUG | 1926 | #ifdef PBZIP_DEBUG |
285 | 1927 | outBuff * lastnext = (prevBlockInSequence != NULL) ? prevBlockInSequence->next : NULL; | 1927 | outBuff * lastnext = (prevBlockInSequence != NULL) ? prevBlockInSequence->next : NULL; |
293 | 1928 | fprintf(stderr, "fileWriter: Block: %d Size: %u Next File Block: %d" | 1928 | fprintf(stderr, "fileWriter: Block: %d Size: %"PRIuMAX" Next File Block: %d" |
294 | 1929 | ", outBufferPos: %u, NumBlocks: %d, producerDone: %d, lastseq=%d" | 1929 | ", outBufferPos: %"PRIuMAX", NumBlocks: %d, producerDone: %d, lastseq=%d" |
295 | 1930 | ", prev=%llx, next=%llx\n", | 1930 | ", prev=%p, next=%p\n", |
296 | 1931 | currBlock, NumBufferedBlocksMax, NextBlockToWrite, | 1931 | currBlock, (uintmax_t)NumBufferedBlocksMax, NextBlockToWrite, |
297 | 1932 | outBufferPos, NumBlocks, syncGetProducerDone(), lastseq, | 1932 | (uintmax_t)outBufferPos, NumBlocks, syncGetProducerDone(), lastseq, |
298 | 1933 | (unsigned long long)prevBlockInSequence, | 1933 | prevBlockInSequence, |
299 | 1934 | (unsigned long long)lastnext); | 1934 | lastnext); |
300 | 1935 | #endif | 1935 | #endif |
301 | 1936 | 1936 | ||
302 | 1937 | if ( (LastGoodBlock != -1) && (NextBlockToWrite > LastGoodBlock) ) | 1937 | if ( (LastGoodBlock != -1) && (NextBlockToWrite > LastGoodBlock) ) |
303 | @@ -1970,7 +1970,7 @@ | |||
304 | 1970 | } | 1970 | } |
305 | 1971 | 1971 | ||
306 | 1972 | #ifdef PBZIP_DEBUG | 1972 | #ifdef PBZIP_DEBUG |
308 | 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", |
309 | 1974 | OutputBuffer[outBufferPos].buf, OutputBuffer[outBufferPos].bufSize, currBlock, | 1974 | OutputBuffer[outBufferPos].buf, OutputBuffer[outBufferPos].bufSize, currBlock, |
310 | 1975 | outBlock->sequenceNumber, (int)outBlock->isLastInSequence); | 1975 | outBlock->sequenceNumber, (int)outBlock->isLastInSequence); |
311 | 1976 | #endif | 1976 | #endif |
312 | @@ -2052,7 +2052,7 @@ | |||
313 | 2052 | } | 2052 | } |
314 | 2053 | 2053 | ||
315 | 2054 | #ifdef PBZIP_DEBUG | 2054 | #ifdef PBZIP_DEBUG |
317 | 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); |
318 | 2056 | fflush(stderr); | 2056 | fflush(stderr); |
319 | 2057 | #else | 2057 | #else |
320 | 2058 | if (percentComplete != percentCompleteOld) | 2058 | if (percentComplete != percentCompleteOld) |
321 | @@ -2090,7 +2090,7 @@ | |||
322 | 2090 | 2090 | ||
323 | 2091 | if (QuietMode != 1) | 2091 | if (QuietMode != 1) |
324 | 2092 | { | 2092 | { |
326 | 2093 | fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)CompressedSize); | 2093 | fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize); |
327 | 2094 | } | 2094 | } |
328 | 2095 | 2095 | ||
329 | 2096 | #ifdef PBZIP_DEBUG | 2096 | #ifdef PBZIP_DEBUG |
330 | @@ -2116,7 +2116,7 @@ | |||
331 | 2116 | percentComplete = 100; | 2116 | percentComplete = 100; |
332 | 2117 | 2117 | ||
333 | 2118 | #ifdef PBZIP_DEBUG | 2118 | #ifdef PBZIP_DEBUG |
335 | 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); |
336 | 2120 | fflush(stderr); | 2120 | fflush(stderr); |
337 | 2121 | #else | 2121 | #else |
338 | 2122 | 2122 | ||
339 | @@ -2190,7 +2190,7 @@ | |||
340 | 2190 | inSize = bytesLeft; | 2190 | inSize = bytesLeft; |
341 | 2191 | 2191 | ||
342 | 2192 | #ifdef PBZIP_DEBUG | 2192 | #ifdef PBZIP_DEBUG |
344 | 2193 | fprintf(stderr, " -> Bytes To Read: %"PRIu64" bytes...\n", inSize); | 2193 | fprintf(stderr, " -> Bytes To Read: %"PRIuMAX" bytes...\n", (uintmax_t)inSize); |
345 | 2194 | #endif | 2194 | #endif |
346 | 2195 | 2195 | ||
347 | 2196 | // allocate memory to read in file | 2196 | // allocate memory to read in file |
348 | @@ -2267,7 +2267,7 @@ | |||
349 | 2267 | } | 2267 | } |
350 | 2268 | 2268 | ||
351 | 2269 | #ifdef PBZIP_DEBUG | 2269 | #ifdef PBZIP_DEBUG |
353 | 2270 | fprintf(stderr, "\n Original Block Size: %u\n", inSize); | 2270 | fprintf(stderr, "\n Original Block Size: %"PRIuMAX"\n", (uintmax_t)inSize); |
354 | 2271 | fprintf(stderr, " Compressed Block Size: %u\n", outSize); | 2271 | fprintf(stderr, " Compressed Block Size: %u\n", outSize); |
355 | 2272 | #endif | 2272 | #endif |
356 | 2273 | 2273 | ||
357 | @@ -2333,7 +2333,7 @@ | |||
358 | 2333 | close(hOutfile); | 2333 | close(hOutfile); |
359 | 2334 | if (QuietMode != 1) | 2334 | if (QuietMode != 1) |
360 | 2335 | { | 2335 | { |
362 | 2336 | fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)CompressedSize); | 2336 | fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize); |
363 | 2337 | } | 2337 | } |
364 | 2338 | 2338 | ||
365 | 2339 | syncSetProducerDone(1); // Not really needed for direct version | 2339 | syncSetProducerDone(1); // Not really needed for direct version |
366 | @@ -2689,7 +2689,7 @@ | |||
367 | 2689 | inSize = blockSize; | 2689 | inSize = blockSize; |
368 | 2690 | 2690 | ||
369 | 2691 | #ifdef PBZIP_DEBUG | 2691 | #ifdef PBZIP_DEBUG |
371 | 2692 | fprintf(stderr, " -> Bytes To Read: %"PRIu64" bytes...\n", inSize); | 2692 | fprintf(stderr, " -> Bytes To Read: %"PRIuMAX" bytes...\n", (uintmax_t)inSize); |
372 | 2693 | #endif | 2693 | #endif |
373 | 2694 | 2694 | ||
374 | 2695 | // allocate memory to read in file | 2695 | // allocate memory to read in file |
375 | @@ -2750,7 +2750,7 @@ | |||
376 | 2750 | } | 2750 | } |
377 | 2751 | } | 2751 | } |
378 | 2752 | #ifdef PBZIP_DEBUG | 2752 | #ifdef PBZIP_DEBUG |
380 | 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); |
381 | 2754 | #endif | 2754 | #endif |
382 | 2755 | 2755 | ||
383 | 2756 | outBuff * queueElement = new(std::nothrow) outBuff(FileData, inSize, NumBlocks, 0); | 2756 | outBuff * queueElement = new(std::nothrow) outBuff(FileData, inSize, NumBlocks, 0); |
384 | @@ -2843,7 +2843,7 @@ | |||
385 | 2843 | } | 2843 | } |
386 | 2844 | 2844 | ||
387 | 2845 | #ifdef PBZIP_DEBUG | 2845 | #ifdef PBZIP_DEBUG |
389 | 2846 | fprintf(stderr, "consumer: Buffer: %x Size: %u Block: %d\n", | 2846 | fprintf(stderr, "consumer: Buffer: %p Size: %u Block: %d\n", |
390 | 2847 | fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber); | 2847 | fileData->buf, (unsigned)fileData->bufSize, fileData->blockNumber); |
391 | 2848 | #endif | 2848 | #endif |
392 | 2849 | 2849 | ||
393 | @@ -3068,7 +3068,7 @@ | |||
394 | 3068 | // unlikely to get here since more likely exception will be thrown | 3068 | // unlikely to get here since more likely exception will be thrown |
395 | 3069 | if (OutputBuffer.size() != size) | 3069 | if (OutputBuffer.size() != size) |
396 | 3070 | { | 3070 | { |
398 | 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); |
399 | 3072 | safe_mutex_unlock(OutMutex); | 3072 | safe_mutex_unlock(OutMutex); |
400 | 3073 | exit(1); | 3073 | exit(1); |
401 | 3074 | } | 3074 | } |
402 | @@ -3762,7 +3762,7 @@ | |||
403 | 3762 | continue; | 3762 | continue; |
404 | 3763 | } | 3763 | } |
405 | 3764 | #ifdef PBZIP_DEBUG | 3764 | #ifdef PBZIP_DEBUG |
407 | 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])); |
408 | 3766 | #endif | 3766 | #endif |
409 | 3767 | // get command line options with single "-" | 3767 | // get command line options with single "-" |
410 | 3768 | // check for multiple switches grouped together | 3768 | // check for multiple switches grouped together |
411 | @@ -3997,11 +3997,11 @@ | |||
412 | 3997 | 3997 | ||
413 | 3998 | // do sanity check to make sure integers are the size we expect | 3998 | // do sanity check to make sure integers are the size we expect |
414 | 3999 | #ifdef PBZIP_DEBUG | 3999 | #ifdef PBZIP_DEBUG |
416 | 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)); |
417 | 4001 | #endif | 4001 | #endif |
418 | 4002 | if (sizeof(OFF_T) <= 4) | 4002 | if (sizeof(OFF_T) <= 4) |
419 | 4003 | { | 4003 | { |
421 | 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)); |
422 | 4005 | if (decompress == 1) | 4005 | if (decompress == 1) |
423 | 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"); |
424 | 4007 | else | 4007 | else |
425 | @@ -4370,7 +4370,7 @@ | |||
426 | 4370 | if (decompress == 1) | 4370 | if (decompress == 1) |
427 | 4371 | fprintf(stderr, " BWT Block Size: %c00k\n", BWTblockSizeChar); | 4371 | fprintf(stderr, " BWT Block Size: %c00k\n", BWTblockSizeChar); |
428 | 4372 | if (strcmp(InFilename, "-") != 0) | 4372 | if (strcmp(InFilename, "-") != 0) |
430 | 4373 | fprintf(stderr, " Input Size: %"PRIu64" bytes\n", (unsigned long long)InFileSize); | 4373 | fprintf(stderr, " Input Size: %"PRIuMAX" bytes\n", (uintmax_t)InFileSize); |
431 | 4374 | } | 4374 | } |
432 | 4375 | 4375 | ||
433 | 4376 | if (decompress == 1) | 4376 | if (decompress == 1) |
434 | @@ -4445,7 +4445,7 @@ | |||
435 | 4445 | } | 4445 | } |
436 | 4446 | if (QuietMode != 1) | 4446 | if (QuietMode != 1) |
437 | 4447 | { | 4447 | { |
439 | 4448 | fprintf(stderr, " Output Size: %"PRIu64" bytes\n", (unsigned long long)sizeof(Bz2HeaderZero)); | 4448 | fprintf(stderr, " Output Size: %u bytes\n", (unsigned)sizeof(Bz2HeaderZero)); |
440 | 4449 | fprintf(stderr, "-------------------------------------------\n"); | 4449 | fprintf(stderr, "-------------------------------------------\n"); |
441 | 4450 | } | 4450 | } |
442 | 4451 | // remove input file unless requested not to by user or error occurred | 4451 | // remove input file unless requested not to by user or error occurred |
443 | @@ -4482,7 +4482,7 @@ | |||
444 | 4482 | NumBufferedBlocksMax = NumBufferedBlocksMax - (numCPU * 2); | 4482 | NumBufferedBlocksMax = NumBufferedBlocksMax - (numCPU * 2); |
445 | 4483 | #ifdef PBZIP_DEBUG | 4483 | #ifdef PBZIP_DEBUG |
446 | 4484 | fprintf(stderr, "pbzip2: maxMemory: %d blockSize: %d\n", maxMemory, blockSize); | 4484 | fprintf(stderr, "pbzip2: maxMemory: %d blockSize: %d\n", maxMemory, blockSize); |
448 | 4485 | fprintf(stderr, "pbzip2: NumBufferedBlocksMax: %u\n", NumBufferedBlocksMax); | 4485 | fprintf(stderr, "pbzip2: NumBufferedBlocksMax: %"PRIuMAX"\n", (uintmax_t)NumBufferedBlocksMax); |
449 | 4486 | #endif | 4486 | #endif |
450 | 4487 | // check to see if our max buffered blocks is less than numCPU, if yes increase maxMemory | 4487 | // check to see if our max buffered blocks is less than numCPU, if yes increase maxMemory |
451 | 4488 | // to support numCPU requested unless -m switch given by user | 4488 | // to support numCPU requested unless -m switch given by user |
452 | @@ -4492,7 +4492,7 @@ | |||
453 | 4492 | { | 4492 | { |
454 | 4493 | NumBufferedBlocksMax = numCPU; | 4493 | NumBufferedBlocksMax = numCPU; |
455 | 4494 | if (QuietMode != 1) | 4494 | if (QuietMode != 1) |
457 | 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); |
458 | 4496 | } | 4496 | } |
459 | 4497 | else | 4497 | else |
460 | 4498 | { | 4498 | { |
461 | 4499 | 4499 | ||
462 | === modified file 'pbzip2.h' | |||
463 | --- pbzip2.h 2011-07-11 21:22:50 +0000 | |||
464 | +++ pbzip2.h 2014-04-13 13:56:00 +0000 | |||
465 | @@ -53,6 +53,9 @@ | |||
466 | 53 | 53 | ||
467 | 54 | #include <stdio.h> | 54 | #include <stdio.h> |
468 | 55 | #include <pthread.h> | 55 | #include <pthread.h> |
469 | 56 | |||
470 | 57 | #define __STDC_FORMAT_MACROS | ||
471 | 58 | #include <inttypes.h> | ||
472 | 56 | } | 59 | } |
473 | 57 | 60 | ||
474 | 58 | // uncomment for debug output | 61 | // uncomment for debug output |