diff options
author | openvcdiff <openvcdiff@132ac840-3546-0410-a738-d3f8764196be> | 2009-03-20 21:56:15 +0000 |
---|---|---|
committer | openvcdiff <openvcdiff@132ac840-3546-0410-a738-d3f8764196be> | 2009-03-20 21:56:15 +0000 |
commit | d18457863096b3685e56f5a8919959f6afbdb121 (patch) | |
tree | 8759c39d66e263bf92dd3e71518f8b34f4ef37a3 /src/vcdiffengine.cc | |
parent | 83bbde0df33922d8dc6fa737cfb306d9caae13b1 (diff) | |
download | open-vcdiff-d18457863096b3685e56f5a8919959f6afbdb121.tar.gz |
Wed, 18 Mar 2009 14:28:23 -0700 Google Inc. <opensource@google.com>
* Issue #14: HashedDictionary may free memory twice if implicitly copied.
* Add private copy constructor and assignment operator for HashedDictionary.
* Issue #18: Building RPM package fails on Fedora 9: Installed (but
unpackaged) file vcdiff.1.gz.
* Some OS, including Fedora 9, automatically compress man pages that are
installed using /usr/bin/install. This confuses the RPM packager, which
expects a file named "vcdiff.1" and finds one named "vcdiff.1.gz" instead.
Use a wild-card character to accept either of these two alternatives.
* Change the VCDIFF block size to 16, but have the encoder discard all matches
smaller than 32 bytes. This doubles the CPU and memory needed by the
encoder, but finds better string matches, producing a more efficient
encoding. Loosen the timing test limit in blockhash_test.cc for the debug
build only.
* Make the code table writer a virtual interface.
* Add an interface SetTargetMatching() to the simple encoder class
VCDEncoder.
* Remove all references to LOG and logging.h from the unit tests and
command-line client.
* Remove all special cases for kBlockSize < 4. kBlockSize must be a multiple
of the machine word size (see blockhash.cc), so it will never be smaller
than 4.
* Use version 1.10 of Automake.
* Incorporate recent changes to gflags package
(http://code.google.com/p/google-gflags/)
* Fix Visual Studio type-mismatch warning in vcdecoder4_test.cc.
* Use address cache helper functions IsSameMode(), IsHereMode(), etc. to
simplify test code.
* Add contributor's name to THANKS file.
git-svn-id: http://open-vcdiff.googlecode.com/svn/trunk@23 132ac840-3546-0410-a738-d3f8764196be
Diffstat (limited to 'src/vcdiffengine.cc')
-rw-r--r-- | src/vcdiffengine.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/vcdiffengine.cc b/src/vcdiffengine.cc index 4d65439..0dcdf77 100644 --- a/src/vcdiffengine.cc +++ b/src/vcdiffengine.cc @@ -18,7 +18,7 @@ #include <stdint.h> // uint32_t #include <string.h> // memcpy #include "blockhash.h" -#include "encodetable.h" +#include "codetablewriter_interface.h" #include "logging.h" #include "rolling_hash.h" @@ -83,7 +83,7 @@ inline size_t VCDiffEngine::EncodeCopyForBestMatch( const char* unencoded_target_start, size_t unencoded_target_size, const BlockHash* target_hash, - VCDiffCodeTableWriter* coder) const { + CodeTableWriterInterface* coder) const { // When FindBestMatch() comes up with a match for a candidate block, // it will populate best_match with the size, source offset, // and target offset of the match. @@ -127,7 +127,7 @@ inline size_t VCDiffEngine::EncodeCopyForBestMatch( inline void VCDiffEngine::AddUnmatchedRemainder( const char* unencoded_target_start, size_t unencoded_target_size, - VCDiffCodeTableWriter* coder) const { + CodeTableWriterInterface* coder) const { if (unencoded_target_size > 0) { coder->Add(unencoded_target_start, unencoded_target_size); } @@ -135,9 +135,10 @@ inline void VCDiffEngine::AddUnmatchedRemainder( // This helper function tells the coder to finish the encoding and write // the results into the output string "diff". -inline void VCDiffEngine::FinishEncoding(size_t target_size, - OutputStringInterface* diff, - VCDiffCodeTableWriter* coder) const { +inline void VCDiffEngine::FinishEncoding( + size_t target_size, + OutputStringInterface* diff, + CodeTableWriterInterface* coder) const { if (target_size != static_cast<size_t>(coder->target_length())) { LOG(DFATAL) << "Internal error in VCDiffEngine::Encode: " "original target size (" << target_size @@ -151,7 +152,7 @@ template<bool look_for_target_matches> void VCDiffEngine::EncodeInternal(const char* target_data, size_t target_size, OutputStringInterface* diff, - VCDiffCodeTableWriter* coder) const { + CodeTableWriterInterface* coder) const { if (!hashed_dictionary_) { LOG(DFATAL) << "Internal error: VCDiffEngine::Encode() " "called before VCDiffEngine::Init()" << LOG_ENDL; @@ -160,11 +161,6 @@ void VCDiffEngine::EncodeInternal(const char* target_data, if (target_size == 0) { return; // Do nothing for empty target } - if (!coder->Init(dictionary_size())) { - LOG(DFATAL) << "Internal error: " - "Initialization of VCDiffCodeTableWriter failed" << LOG_ENDL; - return; - } // Special case for really small input if (target_size < static_cast<size_t>(BlockHash::kBlockSize)) { AddUnmatchedRemainder(target_data, target_size, coder); @@ -242,7 +238,7 @@ void VCDiffEngine::Encode(const char* target_data, size_t target_size, bool look_for_target_matches, OutputStringInterface* diff, - VCDiffCodeTableWriter* coder) const { + CodeTableWriterInterface* coder) const { if (look_for_target_matches) { EncodeInternal<true>(target_data, target_size, diff, coder); } else { |