diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-04-04 22:11:45 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-04-04 22:11:45 +0000 |
commit | f2e6283815f4b598f3aa13441f82228370b8d077 (patch) | |
tree | 82886fbcbce618878dff2fb2ab6229d91e2f69d1 /test/backupdiff/testbackupdiff.cpp | |
parent | d5f9f9c253584cc12cd88c83afd6c6bfcc6ebd68 (diff) |
Undo mangling by tailor
Diffstat (limited to 'test/backupdiff/testbackupdiff.cpp')
-rw-r--r-- | test/backupdiff/testbackupdiff.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/test/backupdiff/testbackupdiff.cpp b/test/backupdiff/testbackupdiff.cpp index a91d6dfe..fb972b2b 100644 --- a/test/backupdiff/testbackupdiff.cpp +++ b/test/backupdiff/testbackupdiff.cpp @@ -110,8 +110,10 @@ void check_encoded_file(const char *filename, int64_t OtherFileID, int new_block TEST_THAT((uint64_t)box_ntoh64(hdr.mOtherFileID) == (uint64_t)OtherFileID); // number of blocks int64_t nblocks = box_ntoh64(hdr.mNumBlocks); - TRACE2("Reading index from '%s', has %lld blocks\n", filename, nblocks); - TRACE0("======== ===== ========== ======== ========\n Index Where EncSz/Idx Size WChcksm\n"); + BOX_TRACE("Reading index from '" << filename << "', has " << + nblocks << " blocks"); + BOX_TRACE("======== ===== ========== ======== ========"); + BOX_TRACE(" Index Where EncSz/Idx Size WChcksm"); // Read them all in int64_t nnew = 0, nold = 0; for(int64_t b = 0; b < nblocks; ++b) @@ -119,35 +121,36 @@ void check_encoded_file(const char *filename, int64_t OtherFileID, int new_block file_BlockIndexEntry en; TEST_THAT(enc.ReadFullBuffer(&en, sizeof(en), 0)); int64_t s = box_ntoh64(en.mEncodedSize); + + // Decode the rest + uint64_t iv = box_ntoh64(hdr.mEntryIVBase); + iv += b; + sBlowfishDecryptBlockEntry.SetIV(&iv); + file_BlockIndexEntryEnc entryEnc; + sBlowfishDecryptBlockEntry.TransformBlock(&entryEnc, + sizeof(entryEnc), en.mEnEnc, sizeof(en.mEnEnc)); + + if(s > 0) { nnew++; - #ifdef WIN32 - TRACE2("%8I64d this s=%8I64d", b, s); - #else - TRACE2("%8lld this s=%8lld", b, s); - #endif + BOX_TRACE(std::setw(8) << b << " this s=" << + std::setw(8) << s << " " << + std::setw(8) << ntohl(entryEnc.mSize) << " " << + std::setw(8) << std::setfill('0') << + std::hex << ntohl(entryEnc.mWeakChecksum)); } else { nold++; - #ifdef WIN32 - TRACE2("%8I64d other i=%8I64d", b, 0 - s); - #else - TRACE2("%8lld other i=%8lld", b, 0 - s); - #endif + BOX_TRACE(std::setw(8) << b << " other i=" << + std::setw(8) << (0-s) << " " << + std::setw(8) << ntohl(entryEnc.mSize) << " " << + std::setw(8) << std::setfill('0') << + std::hex << ntohl(entryEnc.mWeakChecksum)); } - // Decode the rest - uint64_t iv = box_ntoh64(hdr.mEntryIVBase); - iv += b; - sBlowfishDecryptBlockEntry.SetIV(&iv); - file_BlockIndexEntryEnc entryEnc; - sBlowfishDecryptBlockEntry.TransformBlock(&entryEnc, sizeof(entryEnc), - en.mEnEnc, sizeof(en.mEnEnc)); - TRACE2(" %8d %08x\n", ntohl(entryEnc.mSize), ntohl(entryEnc.mWeakChecksum)); - } - TRACE0("======== ===== ========== ======== ========\n"); + BOX_TRACE("======== ===== ========== ======== ========"); TEST_THAT(new_blocks_expected == nnew); TEST_THAT(old_blocks_expected == nold); } |