From 81498dea08759883b4bfdb3335a95da92c9278dd Mon Sep 17 00:00:00 2001 From: "josh.macdonald" Date: Sun, 9 Mar 2014 05:44:20 +0000 Subject: 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). --- xdelta3/testing/file.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'xdelta3/testing/file.h') 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: } void SetSize(size_t size) { - size_ = size; - + uint8_t *t = NULL; if (data_size_ < size) { if (data_) { - delete [] data_; + t = data_; } data_ = new uint8_t[size]; data_size_ = size; } + if (t && size < size_) { + memcpy(data_, t, size); + } + delete [] t; + size_ = size; } + private: friend class BlockIterator; @@ -268,6 +273,7 @@ public: } void SetBlock(xoff_t blkno) { + CHECK_LE(blkno, Blocks()); blkno_ = blkno; } @@ -373,4 +379,3 @@ public: private: mutable main_file file_; }; - -- cgit v1.2.3