Fully qualify std::string.
This is in preparation for removing the snappy::string alias of std::string. PiperOrigin-RevId: 271383199
This commit is contained in:
committed by
Victor Costan
parent
d837d5cfe1
commit
62363d9a79
@@ -73,7 +73,7 @@ namespace snappy {
|
||||
// be able to read previously allocated memory while doing heap allocations.
|
||||
class DataEndingAtUnreadablePage {
|
||||
public:
|
||||
explicit DataEndingAtUnreadablePage(const string& s) {
|
||||
explicit DataEndingAtUnreadablePage(const std::string& s) {
|
||||
const size_t page_size = sysconf(_SC_PAGESIZE);
|
||||
const size_t size = s.size();
|
||||
// Round up space for string to a multiple of page_size.
|
||||
@@ -112,7 +112,7 @@ class DataEndingAtUnreadablePage {
|
||||
#else // defined(HAVE_FUNC_MMAP) && defined(HAVE_FUNC_SYSCONF)
|
||||
|
||||
// Fallback for systems without mmap.
|
||||
typedef string DataEndingAtUnreadablePage;
|
||||
using DataEndingAtUnreadablePage = std::string;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -154,7 +154,7 @@ static size_t MinimumRequiredOutputSpace(size_t input_size,
|
||||
// "compressed" must be preinitialized to at least MinCompressbufSize(comp)
|
||||
// number of bytes, and may contain junk bytes at the end after return.
|
||||
static bool Compress(const char* input, size_t input_size, CompressorType comp,
|
||||
string* compressed, bool compressed_is_preallocated) {
|
||||
std::string* compressed, bool compressed_is_preallocated) {
|
||||
if (!compressed_is_preallocated) {
|
||||
compressed->resize(MinimumRequiredOutputSpace(input_size, comp));
|
||||
}
|
||||
@@ -215,8 +215,8 @@ static bool Compress(const char* input, size_t input_size, CompressorType comp,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Uncompress(const string& compressed, CompressorType comp,
|
||||
int size, string* output) {
|
||||
static bool Uncompress(const std::string& compressed, CompressorType comp,
|
||||
int size, std::string* output) {
|
||||
switch (comp) {
|
||||
#ifdef ZLIB_VERSION
|
||||
case ZLIB: {
|
||||
@@ -279,8 +279,8 @@ static void Measure(const char* data,
|
||||
int num_blocks = (length + block_size - 1) / block_size;
|
||||
std::vector<const char*> input(num_blocks);
|
||||
std::vector<size_t> input_length(num_blocks);
|
||||
std::vector<string> compressed(num_blocks);
|
||||
std::vector<string> output(num_blocks);
|
||||
std::vector<std::string> compressed(num_blocks);
|
||||
std::vector<std::string> output(num_blocks);
|
||||
for (int b = 0; b < num_blocks; b++) {
|
||||
int input_start = b * block_size;
|
||||
int input_limit = std::min<int>((b+1)*block_size, length);
|
||||
@@ -344,11 +344,10 @@ static void Measure(const char* data,
|
||||
|
||||
float comp_rate = (length / ctime[med]) * repeats / 1048576.0;
|
||||
float uncomp_rate = (length / utime[med]) * repeats / 1048576.0;
|
||||
string x = names[comp];
|
||||
std::string x = names[comp];
|
||||
x += ":";
|
||||
string urate = (uncomp_rate >= 0)
|
||||
? StringPrintf("%.1f", uncomp_rate)
|
||||
: string("?");
|
||||
std::string urate =
|
||||
(uncomp_rate >= 0) ? StringPrintf("%.1f", uncomp_rate) : std::string("?");
|
||||
printf("%-7s [b %dM] bytes %6d -> %6d %4.1f%% "
|
||||
"comp %5.1f MB/s uncomp %5s MB/s\n",
|
||||
x.c_str(),
|
||||
@@ -359,8 +358,8 @@ static void Measure(const char* data,
|
||||
urate.c_str());
|
||||
}
|
||||
|
||||
static int VerifyString(const string& input) {
|
||||
string compressed;
|
||||
static int VerifyString(const std::string& input) {
|
||||
std::string compressed;
|
||||
DataEndingAtUnreadablePage i(input);
|
||||
const size_t written = snappy::Compress(i.data(), i.size(), &compressed);
|
||||
CHECK_EQ(written, compressed.size());
|
||||
@@ -368,15 +367,15 @@ static int VerifyString(const string& input) {
|
||||
snappy::MaxCompressedLength(input.size()));
|
||||
CHECK(snappy::IsValidCompressedBuffer(compressed.data(), compressed.size()));
|
||||
|
||||
string uncompressed;
|
||||
std::string uncompressed;
|
||||
DataEndingAtUnreadablePage c(compressed);
|
||||
CHECK(snappy::Uncompress(c.data(), c.size(), &uncompressed));
|
||||
CHECK_EQ(uncompressed, input);
|
||||
return uncompressed.size();
|
||||
}
|
||||
|
||||
static void VerifyStringSink(const string& input) {
|
||||
string compressed;
|
||||
static void VerifyStringSink(const std::string& input) {
|
||||
std::string compressed;
|
||||
DataEndingAtUnreadablePage i(input);
|
||||
const size_t written = snappy::Compress(i.data(), i.size(), &compressed);
|
||||
CHECK_EQ(written, compressed.size());
|
||||
@@ -384,7 +383,7 @@ static void VerifyStringSink(const string& input) {
|
||||
snappy::MaxCompressedLength(input.size()));
|
||||
CHECK(snappy::IsValidCompressedBuffer(compressed.data(), compressed.size()));
|
||||
|
||||
string uncompressed;
|
||||
std::string uncompressed;
|
||||
uncompressed.resize(input.size());
|
||||
snappy::UncheckedByteArraySink sink(string_as_array(&uncompressed));
|
||||
DataEndingAtUnreadablePage c(compressed);
|
||||
@@ -393,8 +392,8 @@ static void VerifyStringSink(const string& input) {
|
||||
CHECK_EQ(uncompressed, input);
|
||||
}
|
||||
|
||||
static void VerifyIOVec(const string& input) {
|
||||
string compressed;
|
||||
static void VerifyIOVec(const std::string& input) {
|
||||
std::string compressed;
|
||||
DataEndingAtUnreadablePage i(input);
|
||||
const size_t written = snappy::Compress(i.data(), i.size(), &compressed);
|
||||
CHECK_EQ(written, compressed.size());
|
||||
@@ -440,13 +439,13 @@ static void VerifyIOVec(const string& input) {
|
||||
|
||||
// Test that data compressed by a compressor that does not
|
||||
// obey block sizes is uncompressed properly.
|
||||
static void VerifyNonBlockedCompression(const string& input) {
|
||||
static void VerifyNonBlockedCompression(const std::string& input) {
|
||||
if (input.length() > snappy::kBlockSize) {
|
||||
// We cannot test larger blocks than the maximum block size, obviously.
|
||||
return;
|
||||
}
|
||||
|
||||
string prefix;
|
||||
std::string prefix;
|
||||
Varint::Append32(&prefix, input.size());
|
||||
|
||||
// Setup compression table
|
||||
@@ -455,7 +454,7 @@ static void VerifyNonBlockedCompression(const string& input) {
|
||||
uint16* table = wmem.GetHashTable(input.size(), &table_size);
|
||||
|
||||
// Compress entire input in one shot
|
||||
string compressed;
|
||||
std::string compressed;
|
||||
compressed += prefix;
|
||||
compressed.resize(prefix.size()+snappy::MaxCompressedLength(input.size()));
|
||||
char* dest = string_as_array(&compressed) + prefix.size();
|
||||
@@ -463,13 +462,13 @@ static void VerifyNonBlockedCompression(const string& input) {
|
||||
dest, table, table_size);
|
||||
compressed.resize(end - compressed.data());
|
||||
|
||||
// Uncompress into string
|
||||
string uncomp_str;
|
||||
// Uncompress into std::string
|
||||
std::string uncomp_str;
|
||||
CHECK(snappy::Uncompress(compressed.data(), compressed.size(), &uncomp_str));
|
||||
CHECK_EQ(uncomp_str, input);
|
||||
|
||||
// Uncompress using source/sink
|
||||
string uncomp_str2;
|
||||
std::string uncomp_str2;
|
||||
uncomp_str2.resize(input.size());
|
||||
snappy::UncheckedByteArraySink sink(string_as_array(&uncomp_str2));
|
||||
snappy::ByteArraySource source(compressed.data(), compressed.size());
|
||||
@@ -481,28 +480,28 @@ static void VerifyNonBlockedCompression(const string& input) {
|
||||
static const int kNumBlocks = 10;
|
||||
struct iovec vec[kNumBlocks];
|
||||
const int block_size = 1 + input.size() / kNumBlocks;
|
||||
string iovec_data(block_size * kNumBlocks, 'x');
|
||||
std::string iovec_data(block_size * kNumBlocks, 'x');
|
||||
for (int i = 0; i < kNumBlocks; i++) {
|
||||
vec[i].iov_base = string_as_array(&iovec_data) + i * block_size;
|
||||
vec[i].iov_len = block_size;
|
||||
}
|
||||
CHECK(snappy::RawUncompressToIOVec(compressed.data(), compressed.size(),
|
||||
vec, kNumBlocks));
|
||||
CHECK_EQ(string(iovec_data.data(), input.size()), input);
|
||||
CHECK_EQ(std::string(iovec_data.data(), input.size()), input);
|
||||
}
|
||||
}
|
||||
|
||||
// Expand the input so that it is at least K times as big as block size
|
||||
static string Expand(const string& input) {
|
||||
static std::string Expand(const std::string& input) {
|
||||
static const int K = 3;
|
||||
string data = input;
|
||||
std::string data = input;
|
||||
while (data.size() < K * snappy::kBlockSize) {
|
||||
data += input;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static int Verify(const string& input) {
|
||||
static int Verify(const std::string& input) {
|
||||
VLOG(1) << "Verifying input of size " << input.size();
|
||||
|
||||
// Compress using string based routines
|
||||
@@ -514,7 +513,7 @@ static int Verify(const string& input) {
|
||||
VerifyNonBlockedCompression(input);
|
||||
VerifyIOVec(input);
|
||||
if (!input.empty()) {
|
||||
const string expanded = Expand(input);
|
||||
const std::string expanded = Expand(input);
|
||||
VerifyNonBlockedCompression(expanded);
|
||||
VerifyIOVec(input);
|
||||
}
|
||||
@@ -522,20 +521,20 @@ static int Verify(const string& input) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool IsValidCompressedBuffer(const string& c) {
|
||||
static bool IsValidCompressedBuffer(const std::string& c) {
|
||||
return snappy::IsValidCompressedBuffer(c.data(), c.size());
|
||||
}
|
||||
static bool Uncompress(const string& c, string* u) {
|
||||
static bool Uncompress(const std::string& c, std::string* u) {
|
||||
return snappy::Uncompress(c.data(), c.size(), u);
|
||||
}
|
||||
|
||||
// This test checks to ensure that snappy doesn't coredump if it gets
|
||||
// corrupted data.
|
||||
TEST(CorruptedTest, VerifyCorrupted) {
|
||||
string source = "making sure we don't crash with corrupted input";
|
||||
std::string source = "making sure we don't crash with corrupted input";
|
||||
VLOG(1) << source;
|
||||
string dest;
|
||||
string uncmp;
|
||||
std::string dest;
|
||||
std::string uncmp;
|
||||
snappy::Compress(source.data(), source.size(), &dest);
|
||||
|
||||
// Mess around with the data. It's hard to simulate all possible
|
||||
@@ -582,9 +581,9 @@ TEST(CorruptedTest, VerifyCorrupted) {
|
||||
|
||||
// try reading stuff in from a bad file.
|
||||
for (int i = 1; i <= 3; ++i) {
|
||||
string data = ReadTestDataFile(StringPrintf("baddata%d.snappy", i).c_str(),
|
||||
0);
|
||||
string uncmp;
|
||||
std::string data =
|
||||
ReadTestDataFile(StringPrintf("baddata%d.snappy", i).c_str(), 0);
|
||||
std::string uncmp;
|
||||
// check that we don't return a crazy length
|
||||
size_t ulen;
|
||||
CHECK(!snappy::GetUncompressedLength(data.data(), data.size(), &ulen)
|
||||
@@ -602,7 +601,7 @@ TEST(CorruptedTest, VerifyCorrupted) {
|
||||
// These mirror the compression code in snappy.cc, but are copied
|
||||
// here so that we can bypass some limitations in the how snappy.cc
|
||||
// invokes these routines.
|
||||
static void AppendLiteral(string* dst, const string& literal) {
|
||||
static void AppendLiteral(std::string* dst, const std::string& literal) {
|
||||
if (literal.empty()) return;
|
||||
int n = literal.size() - 1;
|
||||
if (n < 60) {
|
||||
@@ -617,12 +616,12 @@ static void AppendLiteral(string* dst, const string& literal) {
|
||||
n >>= 8;
|
||||
}
|
||||
dst->push_back(0 | ((59+count) << 2));
|
||||
*dst += string(number, count);
|
||||
*dst += std::string(number, count);
|
||||
}
|
||||
*dst += literal;
|
||||
}
|
||||
|
||||
static void AppendCopy(string* dst, int offset, int length) {
|
||||
static void AppendCopy(std::string* dst, int offset, int length) {
|
||||
while (length > 0) {
|
||||
// Figure out how much to copy in one shot
|
||||
int to_copy;
|
||||
@@ -659,23 +658,23 @@ TEST(Snappy, SimpleTests) {
|
||||
Verify("ab");
|
||||
Verify("abc");
|
||||
|
||||
Verify("aaaaaaa" + string(16, 'b') + string("aaaaa") + "abc");
|
||||
Verify("aaaaaaa" + string(256, 'b') + string("aaaaa") + "abc");
|
||||
Verify("aaaaaaa" + string(2047, 'b') + string("aaaaa") + "abc");
|
||||
Verify("aaaaaaa" + string(65536, 'b') + string("aaaaa") + "abc");
|
||||
Verify("abcaaaaaaa" + string(65536, 'b') + string("aaaaa") + "abc");
|
||||
Verify("aaaaaaa" + std::string(16, 'b') + std::string("aaaaa") + "abc");
|
||||
Verify("aaaaaaa" + std::string(256, 'b') + std::string("aaaaa") + "abc");
|
||||
Verify("aaaaaaa" + std::string(2047, 'b') + std::string("aaaaa") + "abc");
|
||||
Verify("aaaaaaa" + std::string(65536, 'b') + std::string("aaaaa") + "abc");
|
||||
Verify("abcaaaaaaa" + std::string(65536, 'b') + std::string("aaaaa") + "abc");
|
||||
}
|
||||
|
||||
// Verify max blowup (lots of four-byte copies)
|
||||
TEST(Snappy, MaxBlowup) {
|
||||
std::mt19937 rng;
|
||||
std::uniform_int_distribution<int> uniform_byte(0, 255);
|
||||
string input;
|
||||
std::string input;
|
||||
for (int i = 0; i < 80000; ++i)
|
||||
input.push_back(static_cast<char>(uniform_byte(rng)));
|
||||
|
||||
for (int i = 0; i < 80000; i += 4) {
|
||||
string four_bytes(input.end() - i - 4, input.end() - i);
|
||||
std::string four_bytes(input.end() - i - 4, input.end() - i);
|
||||
input.append(four_bytes);
|
||||
}
|
||||
Verify(input);
|
||||
@@ -696,7 +695,7 @@ TEST(Snappy, RandomData) {
|
||||
VLOG(0) << "Random op " << i << " of " << num_ops;
|
||||
}
|
||||
|
||||
string x;
|
||||
std::string x;
|
||||
size_t len = uniform_4k(rng);
|
||||
if (i < 100) {
|
||||
len = 65536 + uniform_64k(rng);
|
||||
@@ -733,19 +732,19 @@ TEST(Snappy, FourByteOffset) {
|
||||
// copy manually.
|
||||
|
||||
// The two fragments that make up the input string.
|
||||
string fragment1 = "012345689abcdefghijklmnopqrstuvwxyz";
|
||||
string fragment2 = "some other string";
|
||||
std::string fragment1 = "012345689abcdefghijklmnopqrstuvwxyz";
|
||||
std::string fragment2 = "some other string";
|
||||
|
||||
// How many times each fragment is emitted.
|
||||
const int n1 = 2;
|
||||
const int n2 = 100000 / fragment2.size();
|
||||
const int length = n1 * fragment1.size() + n2 * fragment2.size();
|
||||
|
||||
string compressed;
|
||||
std::string compressed;
|
||||
Varint::Append32(&compressed, length);
|
||||
|
||||
AppendLiteral(&compressed, fragment1);
|
||||
string src = fragment1;
|
||||
std::string src = fragment1;
|
||||
for (int i = 0; i < n2; i++) {
|
||||
AppendLiteral(&compressed, fragment2);
|
||||
src += fragment2;
|
||||
@@ -754,7 +753,7 @@ TEST(Snappy, FourByteOffset) {
|
||||
src += fragment1;
|
||||
CHECK_EQ(length, src.size());
|
||||
|
||||
string uncompressed;
|
||||
std::string uncompressed;
|
||||
CHECK(snappy::IsValidCompressedBuffer(compressed.data(), compressed.size()));
|
||||
CHECK(snappy::Uncompress(compressed.data(), compressed.size(),
|
||||
&uncompressed));
|
||||
@@ -776,7 +775,7 @@ TEST(Snappy, IOVecEdgeCases) {
|
||||
iov[i].iov_len = kLengths[i];
|
||||
}
|
||||
|
||||
string compressed;
|
||||
std::string compressed;
|
||||
Varint::Append32(&compressed, 22);
|
||||
|
||||
// A literal whose output crosses three blocks.
|
||||
@@ -837,7 +836,7 @@ TEST(Snappy, IOVecLiteralOverflow) {
|
||||
iov[i].iov_len = kLengths[i];
|
||||
}
|
||||
|
||||
string compressed;
|
||||
std::string compressed;
|
||||
Varint::Append32(&compressed, 8);
|
||||
|
||||
AppendLiteral(&compressed, "12345678");
|
||||
@@ -859,7 +858,7 @@ TEST(Snappy, IOVecCopyOverflow) {
|
||||
iov[i].iov_len = kLengths[i];
|
||||
}
|
||||
|
||||
string compressed;
|
||||
std::string compressed;
|
||||
Varint::Append32(&compressed, 8);
|
||||
|
||||
AppendLiteral(&compressed, "123");
|
||||
@@ -873,7 +872,7 @@ TEST(Snappy, IOVecCopyOverflow) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool CheckUncompressedLength(const string& compressed,
|
||||
static bool CheckUncompressedLength(const std::string& compressed,
|
||||
size_t* ulength) {
|
||||
const bool result1 = snappy::GetUncompressedLength(compressed.data(),
|
||||
compressed.size(),
|
||||
@@ -887,7 +886,7 @@ static bool CheckUncompressedLength(const string& compressed,
|
||||
}
|
||||
|
||||
TEST(SnappyCorruption, TruncatedVarint) {
|
||||
string compressed, uncompressed;
|
||||
std::string compressed, uncompressed;
|
||||
size_t ulength;
|
||||
compressed.push_back('\xf0');
|
||||
CHECK(!CheckUncompressedLength(compressed, &ulength));
|
||||
@@ -897,7 +896,7 @@ TEST(SnappyCorruption, TruncatedVarint) {
|
||||
}
|
||||
|
||||
TEST(SnappyCorruption, UnterminatedVarint) {
|
||||
string compressed, uncompressed;
|
||||
std::string compressed, uncompressed;
|
||||
size_t ulength;
|
||||
compressed.push_back('\x80');
|
||||
compressed.push_back('\x80');
|
||||
@@ -912,7 +911,7 @@ TEST(SnappyCorruption, UnterminatedVarint) {
|
||||
}
|
||||
|
||||
TEST(SnappyCorruption, OverflowingVarint) {
|
||||
string compressed, uncompressed;
|
||||
std::string compressed, uncompressed;
|
||||
size_t ulength;
|
||||
compressed.push_back('\xfb');
|
||||
compressed.push_back('\xff');
|
||||
@@ -929,14 +928,14 @@ TEST(Snappy, ReadPastEndOfBuffer) {
|
||||
// Check that we do not read past end of input
|
||||
|
||||
// Make a compressed string that ends with a single-byte literal
|
||||
string compressed;
|
||||
std::string compressed;
|
||||
Varint::Append32(&compressed, 1);
|
||||
AppendLiteral(&compressed, "x");
|
||||
|
||||
string uncompressed;
|
||||
std::string uncompressed;
|
||||
DataEndingAtUnreadablePage c(compressed);
|
||||
CHECK(snappy::Uncompress(c.data(), c.size(), &uncompressed));
|
||||
CHECK_EQ(uncompressed, string("x"));
|
||||
CHECK_EQ(uncompressed, std::string("x"));
|
||||
}
|
||||
|
||||
// Check for an infinite loop caused by a copy with offset==0
|
||||
@@ -1065,7 +1064,7 @@ TEST(Snappy, FindMatchLengthRandom) {
|
||||
std::bernoulli_distribution one_in_typical_length(1.0 / kTypicalLength);
|
||||
|
||||
for (int i = 0; i < kNumTrials; i++) {
|
||||
string s, t;
|
||||
std::string s, t;
|
||||
char a = static_cast<char>(uniform_byte(rng));
|
||||
char b = static_cast<char>(uniform_byte(rng));
|
||||
while (!one_in_typical_length(rng)) {
|
||||
@@ -1180,33 +1179,33 @@ TEST(Snappy, VerifyCharTable) {
|
||||
}
|
||||
|
||||
static void CompressFile(const char* fname) {
|
||||
string fullinput;
|
||||
std::string fullinput;
|
||||
CHECK_OK(file::GetContents(fname, &fullinput, file::Defaults()));
|
||||
|
||||
string compressed;
|
||||
std::string compressed;
|
||||
Compress(fullinput.data(), fullinput.size(), SNAPPY, &compressed, false);
|
||||
|
||||
CHECK_OK(file::SetContents(string(fname).append(".comp"), compressed,
|
||||
CHECK_OK(file::SetContents(std::string(fname).append(".comp"), compressed,
|
||||
file::Defaults()));
|
||||
}
|
||||
|
||||
static void UncompressFile(const char* fname) {
|
||||
string fullinput;
|
||||
std::string fullinput;
|
||||
CHECK_OK(file::GetContents(fname, &fullinput, file::Defaults()));
|
||||
|
||||
size_t uncompLength;
|
||||
CHECK(CheckUncompressedLength(fullinput, &uncompLength));
|
||||
|
||||
string uncompressed;
|
||||
std::string uncompressed;
|
||||
uncompressed.resize(uncompLength);
|
||||
CHECK(snappy::Uncompress(fullinput.data(), fullinput.size(), &uncompressed));
|
||||
|
||||
CHECK_OK(file::SetContents(string(fname).append(".uncomp"), uncompressed,
|
||||
CHECK_OK(file::SetContents(std::string(fname).append(".uncomp"), uncompressed,
|
||||
file::Defaults()));
|
||||
}
|
||||
|
||||
static void MeasureFile(const char* fname) {
|
||||
string fullinput;
|
||||
std::string fullinput;
|
||||
CHECK_OK(file::GetContents(fname, &fullinput, file::Defaults()));
|
||||
printf("%-40s :\n", fname);
|
||||
|
||||
@@ -1259,10 +1258,10 @@ static void BM_UFlat(int iters, int arg) {
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
std::string contents =
|
||||
ReadTestDataFile(files[arg].filename, files[arg].size_limit);
|
||||
|
||||
string zcontents;
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents);
|
||||
char* dst = new char[contents.size()];
|
||||
|
||||
@@ -1285,10 +1284,10 @@ static void BM_UValidate(int iters, int arg) {
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
std::string contents =
|
||||
ReadTestDataFile(files[arg].filename, files[arg].size_limit);
|
||||
|
||||
string zcontents;
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents);
|
||||
|
||||
SetBenchmarkBytesProcessed(static_cast<int64>(iters) *
|
||||
@@ -1308,10 +1307,10 @@ static void BM_UIOVec(int iters, int arg) {
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
std::string contents =
|
||||
ReadTestDataFile(files[arg].filename, files[arg].size_limit);
|
||||
|
||||
string zcontents;
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents);
|
||||
|
||||
// Uncompress into an iovec containing ten entries.
|
||||
@@ -1354,10 +1353,10 @@ static void BM_UFlatSink(int iters, int arg) {
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
std::string contents =
|
||||
ReadTestDataFile(files[arg].filename, files[arg].size_limit);
|
||||
|
||||
string zcontents;
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents);
|
||||
char* dst = new char[contents.size()];
|
||||
|
||||
@@ -1372,7 +1371,7 @@ static void BM_UFlatSink(int iters, int arg) {
|
||||
}
|
||||
StopBenchmarkTiming();
|
||||
|
||||
string s(dst, contents.size());
|
||||
std::string s(dst, contents.size());
|
||||
CHECK_EQ(contents, s);
|
||||
|
||||
delete[] dst;
|
||||
@@ -1386,8 +1385,8 @@ static void BM_ZFlat(int iters, int arg) {
|
||||
// Pick file to process based on "arg"
|
||||
CHECK_GE(arg, 0);
|
||||
CHECK_LT(arg, ARRAYSIZE(files));
|
||||
string contents = ReadTestDataFile(files[arg].filename,
|
||||
files[arg].size_limit);
|
||||
std::string contents =
|
||||
ReadTestDataFile(files[arg].filename, files[arg].size_limit);
|
||||
|
||||
char* dst = new char[snappy::MaxCompressedLength(contents.size())];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user