diff options
author | josh.macdonald <jmacd@users.noreply.github.com> | 2014-03-09 05:44:20 +0000 |
---|---|---|
committer | josh.macdonald <jmacd@users.noreply.github.com> | 2014-03-09 05:44:20 +0000 |
commit | 81498dea08759883b4bfdb3335a95da92c9278dd (patch) | |
tree | 0955937f902a9a9db168cb1283b697092f7690d8 /xdelta3/testing/file.h | |
parent | 9e98593f4cbaa59b8fdef989983a4fc727685b4c (diff) |
Fix issue in xd3_encode_memory causing error when IOPT buffer capacity reached and a copy reaches the end-of-source, causing unexpected request for second source block. New tests to cover this case. Removed the IOPT limit in xd3_encode_memory (improves compression). Doubles sizing of the large-checksum hash table (fewer collisions, better compression).
Diffstat (limited to 'xdelta3/testing/file.h')
-rw-r--r-- | xdelta3/testing/file.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/xdelta3/testing/file.h b/xdelta3/testing/file.h index a204d74..67309ac 100644 --- a/xdelta3/testing/file.h +++ b/xdelta3/testing/file.h | |||
@@ -82,16 +82,21 @@ public: | |||
82 | } | 82 | } |
83 | 83 | ||
84 | void SetSize(size_t size) { | 84 | void SetSize(size_t size) { |
85 | size_ = size; | 85 | uint8_t *t = NULL; |
86 | |||
87 | if (data_size_ < size) { | 86 | if (data_size_ < size) { |
88 | if (data_) { | 87 | if (data_) { |
89 | delete [] data_; | 88 | t = data_; |
90 | } | 89 | } |
91 | data_ = new uint8_t[size]; | 90 | data_ = new uint8_t[size]; |
92 | data_size_ = size; | 91 | data_size_ = size; |
93 | } | 92 | } |
93 | if (t && size < size_) { | ||
94 | memcpy(data_, t, size); | ||
95 | } | ||
96 | delete [] t; | ||
97 | size_ = size; | ||
94 | } | 98 | } |
99 | |||
95 | private: | 100 | private: |
96 | friend class BlockIterator; | 101 | friend class BlockIterator; |
97 | 102 | ||
@@ -268,6 +273,7 @@ public: | |||
268 | } | 273 | } |
269 | 274 | ||
270 | void SetBlock(xoff_t blkno) { | 275 | void SetBlock(xoff_t blkno) { |
276 | CHECK_LE(blkno, Blocks()); | ||
271 | blkno_ = blkno; | 277 | blkno_ = blkno; |
272 | } | 278 | } |
273 | 279 | ||
@@ -373,4 +379,3 @@ public: | |||
373 | private: | 379 | private: |
374 | mutable main_file file_; | 380 | mutable main_file file_; |
375 | }; | 381 | }; |
376 | |||