Lines 1-11
Link Here
|
1 |
--- compression.cc.orig 2015-06-23 12:18:26.923826000 +0800 |
1 |
--- compression.cc.orig 2016-10-12 01:35:11 UTC |
2 |
+++ compression.cc 2015-06-23 12:19:37.282685000 +0800 |
2 |
+++ compression.cc |
3 |
@@ -292,7 +292,7 @@ |
3 |
@@ -55,7 +55,7 @@ public: |
|
|
4 |
{ |
5 |
lzma_ret ret = lzma_code( &strm, ( finish ? LZMA_FINISH : LZMA_RUN ) ); |
6 |
|
7 |
- CHECK( ret == LZMA_OK || ret == LZMA_STREAM_END, "lzma_code error: %d", (int) ret ); |
8 |
+ ZBACKUP_CHECK( ret == LZMA_OK || ret == LZMA_STREAM_END, "lzma_code error: %d", (int) ret ); |
9 |
|
10 |
return ( ret == LZMA_STREAM_END ); |
4 |
} |
11 |
} |
|
|
12 |
@@ -75,7 +75,7 @@ public: |
13 |
uint32_t preset = 6; // TODO: make this customizable, although 6 seems to be |
14 |
// the best option |
15 |
lzma_ret ret = lzma_easy_encoder( &strm, preset, LZMA_CHECK_CRC64 ); |
16 |
- CHECK( ret == LZMA_OK, "lzma_easy_encoder error: %d", (int) ret ); |
17 |
+ ZBACKUP_CHECK( ret == LZMA_OK, "lzma_easy_encoder error: %d", (int) ret ); |
18 |
} |
5 |
}; |
19 |
}; |
6 |
|
20 |
|
|
|
21 |
@@ -85,7 +85,7 @@ public: |
22 |
LZMADecoder() |
23 |
{ |
24 |
lzma_ret ret = lzma_stream_decoder( &strm, UINT64_MAX, 0 ); |
25 |
- CHECK( ret == LZMA_OK,"lzma_stream_decoder error: %d", (int) ret ); |
26 |
+ ZBACKUP_CHECK( ret == LZMA_OK,"lzma_stream_decoder error: %d", (int) ret ); |
27 |
} |
28 |
}; |
29 |
|
30 |
@@ -292,7 +292,7 @@ private: |
31 |
} |
32 |
}; |
33 |
|
7 |
-#include <endian.h> |
34 |
-#include <endian.h> |
8 |
+#include <sys/endian.h> |
35 |
+#include <sys/endian.h> |
9 |
|
36 |
|
10 |
// like NoStreamEnDecoder, but also adds the uncompressed size before the stream |
37 |
// like NoStreamEnDecoder, but also adds the uncompressed size before the stream |
11 |
//NOTE You should make sure that the compression function doesn't overwrite any |
38 |
//NOTE You should make sure that the compression function doesn't overwrite any |
|
|
39 |
@@ -329,7 +329,7 @@ protected: |
40 |
|
41 |
size_t suggestOutputSize( const char* dataIn, size_t availIn ) |
42 |
{ |
43 |
- CHECK( availIn >= sizeof(uint64_t), "not enough input data" ); |
44 |
+ ZBACKUP_CHECK( availIn >= sizeof(uint64_t), "not enough input data" ); |
45 |
// We're not using size_t because we need a type that has the same size on all |
46 |
// architectures. A 32-bit host won't be able to open files with more than |
47 |
// 4GB (actually much less), so 4 byte are enough. Even a 64-bit host would |
48 |
@@ -369,7 +369,7 @@ protected: |
49 |
if ( !doProcessNoSize( dataIn, availIn, dataOut, availOut, reportedOutputSize ) ) |
50 |
return false; |
51 |
|
52 |
- CHECK( reportedOutputSize == neededOutputSize, |
53 |
+ ZBACKUP_CHECK( reportedOutputSize == neededOutputSize, |
54 |
"Size of decoded data is different than expected" ); |
55 |
|
56 |
return true; |
57 |
@@ -412,7 +412,7 @@ protected: |
58 |
bool doProcess( const char* dataIn, size_t availIn, |
59 |
char* dataOut, size_t availOut, size_t& outputSize ) |
60 |
{ |
61 |
- CHECK( availIn <= UINT32_MAX, |
62 |
+ ZBACKUP_CHECK( availIn <= UINT32_MAX, |
63 |
"You want to compress more than 4GB of data?! Sorry, we don't support that, yet." ); |
64 |
|
65 |
memcpy(dataOut, "ABCDEFGHIJKLMNOP", 16); |
66 |
@@ -429,7 +429,7 @@ protected: |
67 |
if ( !doProcessNoSize( dataIn, availIn, dataOut, availOut, outputSize ) ) |
68 |
return false; |
69 |
|
70 |
- CHECK( outputSize <= UINT32_MAX, |
71 |
+ ZBACKUP_CHECK( outputSize <= UINT32_MAX, |
72 |
"The compressed data is more than 4GB?! Sorry, we don't support that, yet." ); |
73 |
*compressedSize = htole32( (uint32_t) outputSize ); |
74 |
|
75 |
@@ -459,7 +459,7 @@ protected: |
76 |
if ( ret == LZO_E_OUTPUT_OVERRUN ) |
77 |
return false; |
78 |
|
79 |
- CHECK( ret >= LZO_E_OK, "lzo1x_decompress_safe failed (code %d)", ret ); |
80 |
+ ZBACKUP_CHECK( ret >= LZO_E_OK, "lzo1x_decompress_safe failed (code %d)", ret ); |
81 |
|
82 |
return true; |
83 |
} |
84 |
@@ -490,7 +490,7 @@ class LZO1X_1_Compression : public Compr |
85 |
if (!initialized) |
86 |
{ |
87 |
int ret = lzo_init(); |
88 |
- CHECK( ret == LZO_E_OK, "lzo_init failed (%d)", ret ); |
89 |
+ ZBACKUP_CHECK( ret == LZO_E_OK, "lzo_init failed (%d)", ret ); |
90 |
initialized = true; |
91 |
} |
92 |
} |
93 |
@@ -573,7 +573,7 @@ bool LZO1X_1_Encoder::doProcessNoSize( c |
94 |
if ( ret == LZO_E_OUTPUT_OVERRUN ) |
95 |
return false; |
96 |
|
97 |
- CHECK( ret >= LZO_E_OK, "lzo1x_1_compress failed (code %d)", ret ); |
98 |
+ ZBACKUP_CHECK( ret >= LZO_E_OK, "lzo1x_1_compress failed (code %d)", ret ); |
99 |
|
100 |
return true; |
101 |
} |
102 |
@@ -644,7 +644,7 @@ bool CompressionMethod::iterator::atEnd( |
103 |
|
104 |
CompressionMethod::iterator& CompressionMethod::iterator::operator ++() |
105 |
{ |
106 |
- CHECK( ptr && *ptr, "Cannot increment the end iterator" ); |
107 |
+ ZBACKUP_CHECK( ptr && *ptr, "Cannot increment the end iterator" ); |
108 |
|
109 |
++ptr; |
110 |
|
111 |
@@ -653,7 +653,7 @@ CompressionMethod::iterator& Compression |
112 |
|
113 |
const_sptr<CompressionMethod> CompressionMethod::iterator::operator *() |
114 |
{ |
115 |
- CHECK( ptr && *ptr, "Cannot dereference the end iterator" ); |
116 |
+ ZBACKUP_CHECK( ptr && *ptr, "Cannot dereference the end iterator" ); |
117 |
|
118 |
return *ptr; |
119 |
} |