diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-05 21:26:44 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-05 21:26:44 +0000 |
commit | b206103abcf358453ac4ed8d4373f44f4c88e5c0 (patch) | |
tree | 7cea7cb470eedc4aafa8579122e25dc4a0e0357d /unittests | |
parent | 48ee81c6798a415bc592255f385bdb8427b9ebcf (diff) | |
download | llvm-b206103abcf358453ac4ed8d4373f44f4c88e5c0.tar.gz llvm-b206103abcf358453ac4ed8d4373f44f4c88e5c0.tar.bz2 llvm-b206103abcf358453ac4ed8d4373f44f4c88e5c0.tar.xz |
Simplify compression API by decompressing into a SmallVector rather than a MemoryBuffer
This avoids an extra copy during decompression and avoids the use of
MemoryBuffer which is a weirdly esoteric device that includes unrelated
concepts like "file name" (its rather generic name is a bit misleading).
Similar refactoring of zlib::compress coming up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/CompressionTest.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/unittests/Support/CompressionTest.cpp b/unittests/Support/CompressionTest.cpp index db6a8bb146..30df0509cc 100644 --- a/unittests/Support/CompressionTest.cpp +++ b/unittests/Support/CompressionTest.cpp @@ -25,14 +25,13 @@ namespace { void TestZlibCompression(StringRef Input, zlib::CompressionLevel Level) { std::unique_ptr<MemoryBuffer> Compressed; - std::unique_ptr<MemoryBuffer> Uncompressed; + SmallString<32> Uncompressed; EXPECT_EQ(zlib::StatusOK, zlib::compress(Input, Compressed, Level)); // Check that uncompressed buffer is the same as original. EXPECT_EQ(zlib::StatusOK, zlib::uncompress(Compressed->getBuffer(), Uncompressed, Input.size())); - EXPECT_EQ(Input.size(), Uncompressed->getBufferSize()); - EXPECT_EQ(0, - memcmp(Input.data(), Uncompressed->getBufferStart(), Input.size())); + EXPECT_EQ(Input.size(), Uncompressed.size()); + EXPECT_EQ(0, memcmp(Input.data(), Uncompressed.data(), Input.size())); if (Input.size() > 0) { // Uncompression fails if expected length is too short. EXPECT_EQ(zlib::StatusBufferTooShort, |