diff options
author | snappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143> | 2012-01-08 17:55:48 +0000 |
---|---|---|
committer | snappy.mirrorbot@gmail.com <snappy.mirrorbot@gmail.com@03e5f5b5-db94-4691-08a0-1a8bf15f6143> | 2012-01-08 17:55:48 +0000 |
commit | 68a4f76c4933ae06e4590b4f47b2d40dbe3ae019 (patch) | |
tree | 1619b15dd46d6bb48eb2022553a12b3f4cec4b65 /snappy.cc | |
parent | 9dfee3cc187181ae12b37f965d139b666b3a2948 (diff) | |
download | snappy-68a4f76c4933ae06e4590b4f47b2d40dbe3ae019.tar.gz |
Minor refactoring to accomodate changes in Google's internal code tree.
git-svn-id: http://snappy.googlecode.com/svn/trunk@57 03e5f5b5-db94-4691-08a0-1a8bf15f6143
Diffstat (limited to 'snappy.cc')
-rw-r--r-- | snappy.cc | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -805,6 +805,15 @@ static bool InternalUncompress(Source* r, SnappyDecompressor decompressor(r); uint32 uncompressed_len = 0; if (!decompressor.ReadUncompressedLength(&uncompressed_len)) return false; + return InternalUncompressAllTags( + &decompressor, writer, uncompressed_len, max_len); +} + +template <typename Writer> +static bool InternalUncompressAllTags(SnappyDecompressor* decompressor, + Writer* writer, + uint32 uncompressed_len, + uint32 max_len) { // Protect against possible DoS attack if (static_cast<uint64>(uncompressed_len) > max_len) { return false; @@ -813,8 +822,8 @@ static bool InternalUncompress(Source* r, writer->SetExpectedLength(uncompressed_len); // Process the entire input - decompressor.DecompressAllTags(writer); - return (decompressor.eof() && writer->CheckLength()); + decompressor->DecompressAllTags(writer); + return (decompressor->eof() && writer->CheckLength()); } bool GetUncompressedLength(Source* source, uint32* result) { |