mirror of
https://github.com/google/snappy.git
synced 2024-12-03 14:53:15 +00:00
Use C++11 style instead of C++20
This commit is contained in:
parent
a60fd602ce
commit
4e693db158
|
@ -46,7 +46,7 @@ namespace {
|
|||
|
||||
void FilesAndLevels(::testing::Benchmark* benchmark) {
|
||||
for (int i = 0; i < ARRAYSIZE(kTestDataFiles); ++i) {
|
||||
for (int level = snappy::CompressionOptions::MinCompressionLevel();
|
||||
for (int/*level=*/snappy::CompressionOptions::MinCompressionLevel();
|
||||
level <= snappy::CompressionOptions::MaxCompressionLevel(); ++level) {
|
||||
benchmark->ArgPair(i, level);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void BM_UFlat(benchmark::State& state) {
|
|||
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{.level = state.range(1)});
|
||||
snappy::CompressionOptions{/*level=*/state.range(1)});
|
||||
char* dst = new char[contents.size()];
|
||||
|
||||
for (auto s : state) {
|
||||
|
@ -130,7 +130,7 @@ void BM_UValidate(benchmark::State& state) {
|
|||
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{.level = state.range(1)});
|
||||
snappy::CompressionOptions{/*level=*/state.range(1)});
|
||||
|
||||
for (auto s : state) {
|
||||
CHECK(snappy::IsValidCompressedBuffer(zcontents.data(), zcontents.size()));
|
||||
|
@ -163,7 +163,7 @@ BENCHMARK(BM_UValidateMedley);
|
|||
void BM_UIOVecSource(benchmark::State& state) {
|
||||
// Pick file to process based on state.range(0).
|
||||
int file_index = state.range(0);
|
||||
int level = state.range(1);
|
||||
int/*level=*/state.range(1);
|
||||
|
||||
CHECK_GE(file_index, 0);
|
||||
CHECK_LT(file_index, ARRAYSIZE(kTestDataFiles));
|
||||
|
@ -193,7 +193,7 @@ void BM_UIOVecSource(benchmark::State& state) {
|
|||
size_t zsize = 0;
|
||||
for (auto s : state) {
|
||||
snappy::RawCompressFromIOVec(iov, contents.size(), dst, &zsize,
|
||||
snappy::CompressionOptions{.level = level});
|
||||
snappy::CompressionOptions{/*level=*/level});
|
||||
benchmark::DoNotOptimize(iov);
|
||||
}
|
||||
state.SetBytesProcessed(static_cast<int64_t>(state.iterations()) *
|
||||
|
@ -268,7 +268,7 @@ void BM_UFlatSink(benchmark::State& state) {
|
|||
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{.level = state.range(1)});
|
||||
snappy::CompressionOptions{/*level=*/state.range(1)});
|
||||
char* dst = new char[contents.size()];
|
||||
|
||||
for (auto s : state) {
|
||||
|
@ -292,7 +292,7 @@ BENCHMARK(BM_UFlatSink)->Apply(FilesAndLevels);
|
|||
void BM_ZFlat(benchmark::State& state) {
|
||||
// Pick file to process based on state.range(0).
|
||||
int file_index = state.range(0);
|
||||
int level = state.range(1);
|
||||
int/*level=*/state.range(1);
|
||||
|
||||
CHECK_GE(file_index, 0);
|
||||
CHECK_LT(file_index, ARRAYSIZE(kTestDataFiles));
|
||||
|
@ -304,7 +304,7 @@ void BM_ZFlat(benchmark::State& state) {
|
|||
size_t zsize = 0;
|
||||
for (auto s : state) {
|
||||
snappy::RawCompress(contents.data(), contents.size(), dst, &zsize,
|
||||
snappy::CompressionOptions{.level = level});
|
||||
snappy::CompressionOptions{/*level=*/level});
|
||||
benchmark::DoNotOptimize(dst);
|
||||
}
|
||||
state.SetBytesProcessed(static_cast<int64_t>(state.iterations()) *
|
||||
|
@ -323,7 +323,7 @@ BENCHMARK(BM_ZFlat)->Apply(FilesAndLevels);
|
|||
|
||||
void BM_ZFlatAll(benchmark::State& state) {
|
||||
const int num_files = ARRAYSIZE(kTestDataFiles);
|
||||
int level = state.range(0);
|
||||
int/*level=*/state.range(0);
|
||||
|
||||
std::vector<std::string> contents(num_files);
|
||||
std::vector<char*> dst(num_files);
|
||||
|
@ -340,7 +340,7 @@ void BM_ZFlatAll(benchmark::State& state) {
|
|||
for (auto s : state) {
|
||||
for (int i = 0; i < num_files; ++i) {
|
||||
snappy::RawCompress(contents[i].data(), contents[i].size(), dst[i],
|
||||
&zsize, snappy::CompressionOptions{.level = level});
|
||||
&zsize, snappy::CompressionOptions{/*level=*/level});
|
||||
benchmark::DoNotOptimize(dst);
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ BENCHMARK(BM_ZFlatAll)->DenseRange(1, 2);
|
|||
|
||||
void BM_ZFlatIncreasingTableSize(benchmark::State& state) {
|
||||
CHECK_GT(ARRAYSIZE(kTestDataFiles), 0);
|
||||
int level = state.range(0);
|
||||
int/*level=*/state.range(0);
|
||||
const std::string base_content = ReadTestDataFile(
|
||||
kTestDataFiles[0].filename, kTestDataFiles[0].size_limit);
|
||||
|
||||
|
@ -377,7 +377,7 @@ void BM_ZFlatIncreasingTableSize(benchmark::State& state) {
|
|||
for (auto s : state) {
|
||||
for (size_t i = 0; i < contents.size(); ++i) {
|
||||
snappy::RawCompress(contents[i].data(), contents[i].size(), dst[i],
|
||||
&zsize, snappy::CompressionOptions{.level = level});
|
||||
&zsize, snappy::CompressionOptions{/*level=*/level});
|
||||
benchmark::DoNotOptimize(dst);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||
std::string compressed;
|
||||
size_t compressed_size =
|
||||
snappy::Compress(input.data(), input.size(), &compressed,
|
||||
snappy::CompressionOptions{.level = level});
|
||||
snappy::CompressionOptions{/*level=*/level});
|
||||
|
||||
(void)compressed_size; // Variable only used in debug builds.
|
||||
assert(compressed_size == compressed.size());
|
||||
|
|
Loading…
Reference in a new issue