View | Details | Raw Unified | Return to bug 212973 | Differences between
and this patch

Collapse All | Expand All

(-)files/patch-backup__creator.cc (+29 lines)
Line 0 Link Here
1
--- backup_creator.cc.orig	2016-10-12 01:34:15 UTC
2
+++ backup_creator.cc
3
@@ -109,7 +109,7 @@ void BackupCreator::handleMoreData( unsi
4
 
5
 void BackupCreator::saveChunkToSave()
6
 {
7
-  CHECK( chunkToSaveFill > 0, "chunk to save is empty" );
8
+  ZBACKUP_CHECK( chunkToSaveFill > 0, "chunk to save is empty" );
9
 
10
   if ( chunkToSaveFill < 128 ) // TODO: make this value configurable
11
   {
12
@@ -162,7 +162,7 @@ void BackupCreator::finish()
13
 
14
   // Concatenate the rest of data and save it too
15
 
16
-  CHECK( chunkToSaveFill + ringBufferFill <= chunkMaxSize, "had more than two "
17
+  ZBACKUP_CHECK( chunkToSaveFill + ringBufferFill <= chunkMaxSize, "had more than two "
18
          "full chunks at backup finish" );
19
 
20
   moveFromRingBufferToChunkToSave( ringBufferFill );
21
@@ -274,7 +274,7 @@ void BackupCreator::outputInstruction( B
22
 
23
 void BackupCreator::getBackupData( string & str )
24
 {
25
-  CHECK( backupDataStream.get(), "getBackupData() called twice" );
26
+  ZBACKUP_CHECK( backupDataStream.get(), "getBackupData() called twice" );
27
   backupDataStream.reset();
28
   str.swap( backupData );
29
 }
(-)files/patch-check.hh (+35 lines)
Line 0 Link Here
1
--- check.hh.orig	2016-10-12 01:34:15 UTC
2
+++ check.hh
3
@@ -10,12 +10,12 @@
4
 
5
 // Run-time assertion macro
6
 
7
-// Usage: CHECK( value == 16, "Value is not 16: %d", value );
8
+// Usage: ZBACKUP_CHECK( value == 16, "Value is not 16: %d", value );
9
 // This will abort() if the value is not 16 with the message stating so.
10
 
11
 // TODO: show the backtrace here, without using __FILE__ __LINE__
12
 
13
-#define CHECK( condition, message, ... ) ({if (!(condition)) \
14
+#define ZBACKUP_CHECK( condition, message, ... ) ({if (!(condition)) \
15
 { \
16
   fprintf( stderr, "Check failed: " ); \
17
   fprintf( stderr, message, ##__VA_ARGS__ ); \
18
@@ -23,7 +23,7 @@
19
   abort(); \
20
 }})
21
 
22
-#define FAIL( ... ) CHECK( false, __VA_ARGS__ )
23
+#define FAIL( ... ) ZBACKUP_CHECK( false, __VA_ARGS__ )
24
 
25
 
26
 // Debug-only versions. Only instantiated in debug builds
27
@@ -31,7 +31,7 @@
28
 #define DCHECK CHECK
29
 #define DFAIL FAIL
30
 #else
31
-#define DCHECK( ... )
32
+#define DZBACKUP_CHECK( ... )
33
 #define DFAIL( ... )
34
 #endif
35
 
(-)files/patch-chunk__id.cc (+11 lines)
Line 0 Link Here
1
--- chunk_id.cc.orig	2016-10-12 01:34:15 UTC
2
+++ chunk_id.cc
3
@@ -48,7 +48,7 @@ bool operator <( const ChunkId &lhs, con
4
 
5
 ChunkId::ChunkId( string const & blob )
6
 {
7
-  CHECK( blob.size() == BlobSize, "incorrect blob size: %zu", blob.size() );
8
+  ZBACKUP_CHECK( blob.size() == BlobSize, "incorrect blob size: %zu", blob.size() );
9
 
10
   setFromBlob( blob.data() );
11
 }
(-)files/patch-chunk__storage.cc (+11 lines)
Line 0 Link Here
1
--- chunk_storage.cc.orig	2016-10-12 01:34:15 UTC
2
+++ chunk_storage.cc
3
@@ -179,7 +179,7 @@ void * Writer::Compressor::Compressor::t
4
 
5
   {
6
     Lock _( writer.runningCompressorsMutex );
7
-    CHECK( writer.runningCompressors, "no running compressors" );
8
+    ZBACKUP_CHECK( writer.runningCompressors, "no running compressors" );
9
     --writer.runningCompressors;
10
     writer.runningCompressorsCondition.signal();
11
   }
(-)files/patch-compression.cc (-3 / +111 lines)
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
 }
(-)files/patch-dir.cc (-3 / +3 lines)
Lines 1-6 Link Here
1
--- dir.cc.orig	2015-06-23 12:16:14.909394000 +0800
1
--- dir.cc.orig	2016-10-12 01:35:11 UTC
2
+++ dir.cc	2015-06-23 12:16:22.284741000 +0800
2
+++ dir.cc
3
@@ -103,7 +103,7 @@
3
@@ -103,7 +103,7 @@ bool Listing::getNext( Entry & result )
4
     if ( !entryPtr )
4
     if ( !entryPtr )
5
       return false;
5
       return false;
6
 
6
 
(-)files/patch-encrypted__file.cc (+71 lines)
Line 0 Link Here
1
--- encrypted_file.cc.orig	2016-10-12 01:34:15 UTC
2
+++ encrypted_file.cc
3
@@ -79,10 +79,10 @@ bool InputStream::Next( void const ** da
4
 
5
 void InputStream::BackUp( int count )
6
 {
7
-  CHECK( count >= 0, "count is negative" );
8
+  ZBACKUP_CHECK( count >= 0, "count is negative" );
9
   if ( !backedUp )
10
   {
11
-    CHECK( (size_t) count <= fill, "Backing up too much" );
12
+    ZBACKUP_CHECK( (size_t) count <= fill, "Backing up too much" );
13
     size_t consumed = fill - count;
14
     adler32.add( start, consumed );
15
     start += consumed;
16
@@ -92,13 +92,13 @@ void InputStream::BackUp( int count )
17
   }
18
   else
19
   {
20
-    CHECK( count == 0, "backing up after being backed up already" );
21
+    ZBACKUP_CHECK( count == 0, "backing up after being backed up already" );
22
   }
23
 }
24
 
25
 bool InputStream::Skip( int count )
26
 {
27
-  CHECK( count >= 0, "count is negative" );
28
+  ZBACKUP_CHECK( count >= 0, "count is negative" );
29
 
30
   // We always need to read and decrypt data, as otherwise both the state of
31
   // CBC and adler32 would be incorrect
32
@@ -219,7 +219,7 @@ void InputStream::doDecrypt()
33
 
34
   // We don't throw an exception here as the interface we implement doesn't
35
   // support them
36
-  CHECK( fill > 0 && !( fill % BlockSize ), "incorrect size of the encrypted "
37
+  ZBACKUP_CHECK( fill > 0 && !( fill % BlockSize ), "incorrect size of the encrypted "
38
          "file - must be non-zero and in multiples of %u",
39
          ( unsigned ) BlockSize );
40
 
41
@@ -276,10 +276,10 @@ bool OutputStream::Next( void ** data, i
42
 
43
 void OutputStream::BackUp( int count )
44
 {
45
-  CHECK( count >= 0, "count is negative" );
46
+  ZBACKUP_CHECK( count >= 0, "count is negative" );
47
   if ( !backedUp )
48
   {
49
-    CHECK( (size_t) count <= avail, "Backing up too much" );
50
+    ZBACKUP_CHECK( (size_t) count <= avail, "Backing up too much" );
51
     size_t consumed = avail - count;
52
     adler32.add( start, consumed );
53
     start += consumed;
54
@@ -289,7 +289,7 @@ void OutputStream::BackUp( int count )
55
   }
56
   else
57
   {
58
-    CHECK( count == 0, "backing up after being backed up already" );
59
+    ZBACKUP_CHECK( count == 0, "backing up after being backed up already" );
60
   }
61
 }
62
 
63
@@ -350,7 +350,7 @@ void OutputStream::encryptAndWrite( size
64
 {
65
   if ( key.hasKey() )
66
   {
67
-    CHECK( bytes > 0 && !( bytes % BlockSize ), "incorrect number of bytes to "
68
+    ZBACKUP_CHECK( bytes > 0 && !( bytes % BlockSize ), "incorrect number of bytes to "
69
            "encrypt and write - must be non-zero and in multiples of %u",
70
            ( unsigned ) BlockSize );
71
 
(-)files/patch-encryption.cc (+38 lines)
Line 0 Link Here
1
--- encryption.cc.orig	2016-10-12 01:34:15 UTC
2
+++ encryption.cc
3
@@ -19,7 +19,7 @@ void const * encrypt( void const * iv, v
4
 {
5
   unsigned char block[ BlockSize ];
6
 
7
-  CHECK( !( size % BlockSize ), "size of data to encrypt is not a multiple of "
8
+  ZBACKUP_CHECK( !( size % BlockSize ), "size of data to encrypt is not a multiple of "
9
          "block size" );
10
 
11
   AES_KEY key;
12
@@ -55,7 +55,7 @@ void const * encrypt( void const * iv, v
13
 
14
 void const * getNextDecryptionIv( void const * in, size_t size )
15
 {
16
-  CHECK( !( size % BlockSize ), "size of data to decrypt is not a multiple of "
17
+  ZBACKUP_CHECK( !( size % BlockSize ), "size of data to decrypt is not a multiple of "
18
          "block size" );
19
   return ( char const * ) in + size - BlockSize;
20
 }
21
@@ -63,7 +63,7 @@ void const * getNextDecryptionIv( void c
22
 void decrypt( void const * iv, void const * keyData, void const * inData,
23
               void * outData, size_t size )
24
 {
25
-  CHECK( !( size % BlockSize ), "size of data to decrypt is not a multiple of "
26
+  ZBACKUP_CHECK( !( size % BlockSize ), "size of data to decrypt is not a multiple of "
27
          "block size" );
28
 
29
   AES_KEY key;
30
@@ -96,7 +96,7 @@ void decrypt( void const * iv, void cons
31
 
32
 void pad( void * data, size_t size )
33
 {
34
-  CHECK( size < BlockSize, "size to pad is too large: %zu bytes", size );
35
+  ZBACKUP_CHECK( size < BlockSize, "size to pad is too large: %zu bytes", size );
36
   unsigned char * p = ( unsigned char * ) data + size;
37
   unsigned char v = BlockSize - size;
38
   for ( size_t count = v; count--; )
(-)files/patch-encryption__key.cc (+20 lines)
Line 0 Link Here
1
--- encryption_key.cc.orig	2016-10-12 01:34:15 UTC
2
+++ encryption_key.cc
3
@@ -15,7 +15,7 @@ namespace {
4
 void deriveKey( string const & password, EncryptionKeyInfo const & info,
5
                         void * key, unsigned keySize )
6
 {
7
-  CHECK( PKCS5_PBKDF2_HMAC_SHA1( password.data(), password.size(),
8
+  ZBACKUP_CHECK( PKCS5_PBKDF2_HMAC_SHA1( password.data(), password.size(),
9
                                  (unsigned char const *) info.salt().data(),
10
                                  info.salt().size(), info.rounds(), keySize,
11
                                  (unsigned char *) key ) == 1,
12
@@ -27,7 +27,7 @@ string calculateKeyHmac( void const * ke
13
 {
14
   char result[ EVP_MAX_MD_SIZE ];
15
   unsigned resultSize;
16
-  CHECK( HMAC( EVP_sha1(), (unsigned char const *) key, keySize,
17
+  ZBACKUP_CHECK( HMAC( EVP_sha1(), (unsigned char const *) key, keySize,
18
                (unsigned char const *) input.data(), input.size(),
19
                (unsigned char *) result, &resultSize ),
20
          "encryption key HMAC calcuation failed" );
(-)files/patch-endian.hh (-2 / +2 lines)
Lines 1-5 Link Here
1
--- endian.hh.orig	2014-11-08 22:55:49.000000000 +0800
1
--- endian.hh.orig	2016-10-12 01:35:11 UTC
2
+++ endian.hh	2014-11-08 22:56:01.000000000 +0800
2
+++ endian.hh
3
@@ -6,7 +6,7 @@
3
@@ -6,7 +6,7 @@
4
 
4
 
5
 #include <stdint.h>
5
 #include <stdint.h>
(-)files/patch-file.cc (-3 / +3 lines)
Lines 1-5 Link Here
1
--- file.cc.orig	2014-12-16 20:32:29.000000000 +0800
1
--- file.cc.orig	2016-10-12 01:35:11 UTC
2
+++ file.cc	2015-06-23 13:16:37.741129000 +0800
2
+++ file.cc
3
@@ -6,7 +6,7 @@
3
@@ -6,7 +6,7 @@
4
 #include <unistd.h>
4
 #include <unistd.h>
5
 #include <cerrno>
5
 #include <cerrno>
Lines 9-15 Link Here
9
   #include <sys/socket.h>
9
   #include <sys/socket.h>
10
 #else
10
 #else
11
   #include <sys/sendfile.h>
11
   #include <sys/sendfile.h>
12
@@ -67,6 +67,9 @@
12
@@ -67,6 +67,9 @@ void File::rename( std::string const & f
13
       #ifdef __APPLE__
13
       #ifdef __APPLE__
14
       if ( -1 == sendfile(write_fd, read_fd, offset, &stat_buf.st_size, NULL, 0) )
14
       if ( -1 == sendfile(write_fd, read_fd, offset, &stat_buf.st_size, NULL, 0) )
15
          throw exCantRename( from + " to " + to );
15
          throw exCantRename( from + " to " + to );
(-)files/patch-mt.cc (+18 lines)
Line 0 Link Here
1
--- mt.cc.orig	2016-10-12 01:34:15 UTC
2
+++ mt.cc
3
@@ -58,13 +58,13 @@ void * Thread::__thread_routine( void * 
4
 
5
 void Thread::start()
6
 {
7
-  CHECK( pthread_create( &thread, 0, &__thread_routine, this ) == 0,
8
+  ZBACKUP_CHECK( pthread_create( &thread, 0, &__thread_routine, this ) == 0,
9
          "pthread_create() failed" );
10
 }
11
 
12
 void Thread::detach()
13
 {
14
-  CHECK( pthread_detach( thread ) == 0, "pthread_detach() failed" );
15
+  ZBACKUP_CHECK( pthread_detach( thread ) == 0, "pthread_detach() failed" );
16
 }
17
 
18
 void * Thread::join()
(-)files/patch-tests_bundle_test__bundle.cc (+35 lines)
Line 0 Link Here
1
--- tests/bundle/test_bundle.cc.orig	2016-10-12 01:34:15 UTC
2
+++ tests/bundle/test_bundle.cc
3
@@ -48,8 +48,8 @@ void testCompatibility()
4
       BundleFileHeader header;
5
       Message::parse( header, is );
6
 
7
-      CHECK( header.version()            == 42,     "version is wrong when reading old header with new program" );
8
-      CHECK( header.compression_method() == "lzma", "compression_method is wrong when reading old header with new program" );
9
+      ZBACKUP_CHECK( header.version()            == 42,     "version is wrong when reading old header with new program" );
10
+      ZBACKUP_CHECK( header.compression_method() == "lzma", "compression_method is wrong when reading old header with new program" );
11
     }
12
   }
13
 
14
@@ -71,7 +71,7 @@ void testCompatibility()
15
       FileHeader header;
16
       Message::parse( header, is );
17
 
18
-      CHECK( header.version() == 42,     "version is wrong when reading new header with old program" );
19
+      ZBACKUP_CHECK( header.version() == 42,     "version is wrong when reading new header with old program" );
20
       // cannot check compression_method because the field doesn't exist
21
     }
22
   }
23
@@ -123,9 +123,9 @@ void readAndWrite( EncryptionKey const &
24
       string data;
25
       size_t size;
26
       bool ret = bundle.get( chunkIds[i], data, size );
27
-      CHECK( ret, "bundle.get returned false for chunk %d (%s)", i, chunkIds[i].c_str() );
28
-      CHECK( size == chunkSize, "wrong chunk size for chunk %d (%s)", i, chunkIds[i].c_str() );
29
-      CHECK( memcmp(data.c_str(), chunks[i], chunkSize) == 0, "wrong chunk data for chunk %d (%s)", i, chunkIds[i].c_str() );
30
+      ZBACKUP_CHECK( ret, "bundle.get returned false for chunk %d (%s)", i, chunkIds[i].c_str() );
31
+      ZBACKUP_CHECK( size == chunkSize, "wrong chunk size for chunk %d (%s)", i, chunkIds[i].c_str() );
32
+      ZBACKUP_CHECK( memcmp(data.c_str(), chunks[i], chunkSize) == 0, "wrong chunk data for chunk %d (%s)", i, chunkIds[i].c_str() );
33
     }
34
   }
35
 
(-)files/patch-tests_encrypted__file_test__encrypted__file.cc (+89 lines)
Line 0 Link Here
1
--- tests/encrypted_file/test_encrypted_file.cc.orig	2016-10-12 01:34:15 UTC
2
+++ tests/encrypted_file/test_encrypted_file.cc
3
@@ -47,11 +47,11 @@ void readAndWrite( EncryptionKey const &
4
     int avail = 0;
5
     for ( int left = fileSize; left; )
6
     {
7
-      CHECK( out.ByteCount() == fileSize - left, "Incorrect bytecount in the "
8
+      ZBACKUP_CHECK( out.ByteCount() == fileSize - left, "Incorrect bytecount in the "
9
              "middle of writing" );
10
       void * data;
11
-      CHECK( out.Next( &data, &avail ), "out.Next() returned false" );
12
-      CHECK( avail > 0, "out.Next() returned zero size" );
13
+      ZBACKUP_CHECK( out.Next( &data, &avail ), "out.Next() returned false" );
14
+      ZBACKUP_CHECK( avail > 0, "out.Next() returned zero size" );
15
 
16
       bool doBackup = writeBackups && ( rand() & 1 );
17
       int backup;
18
@@ -77,7 +77,7 @@ void readAndWrite( EncryptionKey const &
19
 
20
       if ( !avail && ( rand() & 1 ) )
21
       {
22
-        CHECK( adler( next - rnd ) == out.getAdler32(),
23
+        ZBACKUP_CHECK( adler( next - rnd ) == out.getAdler32(),
24
                "bad adler32 in the middle of writing" );
25
       }
26
     }
27
@@ -85,11 +85,11 @@ void readAndWrite( EncryptionKey const &
28
     if ( avail || ( rand() & 1 ) )
29
       out.BackUp( avail );
30
 
31
-    CHECK( out.ByteCount() == fileSize, "Incorrect bytecount after writing" );
32
+    ZBACKUP_CHECK( out.ByteCount() == fileSize, "Incorrect bytecount after writing" );
33
 
34
     if ( rand() & 1 )
35
     {
36
-      CHECK( adler( fileSize ) == out.getAdler32(),
37
+      ZBACKUP_CHECK( adler( fileSize ) == out.getAdler32(),
38
              "bad adler32 of the written file" );
39
     }
40
   }
41
@@ -114,11 +114,11 @@ void readAndWrite( EncryptionKey const &
42
         continue;
43
       }
44
 
45
-      CHECK( in.ByteCount() == fileSize - left, "Incorrect bytecount in the "
46
+      ZBACKUP_CHECK( in.ByteCount() == fileSize - left, "Incorrect bytecount in the "
47
              "middle of reading" );
48
-      CHECK( in.Next( &data, &avail ), "file ended while %d were still left",
49
+      ZBACKUP_CHECK( in.Next( &data, &avail ), "file ended while %d were still left",
50
              left );
51
-      CHECK( avail > 0, "in.Next() returned zero size" );
52
+      ZBACKUP_CHECK( avail > 0, "in.Next() returned zero size" );
53
 
54
       bool doBackup = readBackups && ( rand() & 1 );
55
       int backup;
56
@@ -130,7 +130,7 @@ void readAndWrite( EncryptionKey const &
57
 
58
       int toRead = avail > left ? left : avail;
59
 
60
-      CHECK( memcmp( next, data, toRead ) == 0, "Different bytes read than "
61
+      ZBACKUP_CHECK( memcmp( next, data, toRead ) == 0, "Different bytes read than "
62
              "expected at offset %d", int( next - rnd ) );
63
 
64
       if ( doBackup )
65
@@ -142,19 +142,19 @@ void readAndWrite( EncryptionKey const &
66
 
67
       if ( !avail && ( rand() & 1 ) )
68
       {
69
-        CHECK( adler( next - rnd ) == in.getAdler32(),
70
+        ZBACKUP_CHECK( adler( next - rnd ) == in.getAdler32(),
71
                "bad adler32 in the middle of the reading" );
72
       }
73
     }
74
 
75
-    CHECK( in.ByteCount() == fileSize, "Incorrect bytecount after reading" );
76
+    ZBACKUP_CHECK( in.ByteCount() == fileSize, "Incorrect bytecount after reading" );
77
 
78
-    CHECK( !avail, "at least %d bytes still available", avail );
79
-    CHECK( !in.Next( &data, &avail ), "file should have ended but resulted in "
80
+    ZBACKUP_CHECK( !avail, "at least %d bytes still available", avail );
81
+    ZBACKUP_CHECK( !in.Next( &data, &avail ), "file should have ended but resulted in "
82
            "%d more bytes", avail );
83
     if ( rand() & 1 )
84
     {
85
-      CHECK( adler( fileSize ) == in.getAdler32(),
86
+      ZBACKUP_CHECK( adler( fileSize ) == in.getAdler32(),
87
              "bad adler32 of the read file" );
88
     }
89
   }
(-)files/patch-unbuffered__file.cc (+38 lines)
Line 0 Link Here
1
--- unbuffered_file.cc.orig	2016-10-12 01:35:11 UTC
2
+++ unbuffered_file.cc
3
@@ -13,7 +13,7 @@
4
 #include "unbuffered_file.hh"
5
 
6
 
7
-#ifdef __APPLE__
8
+#if defined(__APPLE_) || defined(__FreeBSD__)
9
 #define lseek64 lseek
10
 #endif
11
 
12
@@ -24,7 +24,7 @@ UnbufferedFile::UnbufferedFile( char con
13
 
14
   int flags = ( mode == WriteOnly ? ( O_WRONLY | O_CREAT | O_TRUNC ) :
15
                                     O_RDONLY );
16
-#ifndef __APPLE__
17
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
18
   flags |= O_LARGEFILE;
19
 #endif
20
   fd = open( fileName, flags, 0666 );
21
@@ -49,7 +49,7 @@ size_t UnbufferedFile::read( void * buf,
22
     else
23
     if ( rd > 0 )
24
     {
25
-      CHECK( ( size_t ) rd <= left, "read too many bytes from a file" );
26
+      ZBACKUP_CHECK( ( size_t ) rd <= left, "read too many bytes from a file" );
27
       next += rd;
28
       left -= rd;
29
     }
30
@@ -76,7 +76,7 @@ void UnbufferedFile::write( void const *
31
     }
32
     else
33
     {
34
-      CHECK( ( size_t ) written <= left, "wrote too many bytes to a file" );
35
+      ZBACKUP_CHECK( ( size_t ) written <= left, "wrote too many bytes to a file" );
36
       next += written;
37
       left -= written;
38
     }
(-)files/patch-unbuffered_file.cc (-20 lines)
Lines 1-20 Link Here
1
--- unbuffered_file.cc.orig	2014-11-08 22:56:14.000000000 +0800
2
+++ unbuffered_file.cc	2014-11-08 22:56:25.000000000 +0800
3
@@ -13,7 +13,7 @@
4
 #include "unbuffered_file.hh"
5
 
6
 
7
-#ifdef __APPLE__
8
+#if defined(__APPLE_) || defined(__FreeBSD__)
9
 #define lseek64 lseek
10
 #endif
11
 
12
@@ -24,7 +24,7 @@
13
 
14
   int flags = ( mode == WriteOnly ? ( O_WRONLY | O_CREAT | O_TRUNC ) :
15
                                     O_RDONLY );
16
-#ifndef __APPLE__
17
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
18
   flags |= O_LARGEFILE;
19
 #endif
20
   fd = open( fileName, flags, 0666 );
(-)files/patch-zcollector.cc (-2 / +2 lines)
Lines 1-5 Link Here
1
--- zcollector.cc.orig	2016-01-02 22:43:40.800025000 +0800
1
--- zcollector.cc.orig	2016-10-12 01:35:11 UTC
2
+++ zcollector.cc	2016-01-02 22:44:51.222600000 +0800
2
+++ zcollector.cc
3
@@ -1,6 +1,8 @@
3
@@ -1,6 +1,8 @@
4
 // Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and ZBackup contributors, see CONTRIBUTORS
4
 // Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and ZBackup contributors, see CONTRIBUTORS
5
 // Part of ZBackup. Licensed under GNU GPLv2 or later + OpenSSL, see LICENSE
5
 // Part of ZBackup. Licensed under GNU GPLv2 or later + OpenSSL, see LICENSE

Return to bug 212973