mirror of
https://github.com/google/snappy.git
synced 2024-11-26 16:31:40 +00:00
Fix all compilation errors to be C++11 compliant
This commit is contained in:
parent
ab38064abe
commit
6b2eb7028b
3
snappy.h
3
snappy.h
|
@ -64,6 +64,9 @@ namespace snappy {
|
|||
// faster decompression speeds than snappy:1 and zstd:-3.
|
||||
int level = DefaultCompressionLevel();
|
||||
|
||||
constexpr CompressionOptions() = default;
|
||||
constexpr CompressionOptions(int compression_level)
|
||||
: level(compression_level) {}
|
||||
static constexpr int MinCompressionLevel() { return 1; }
|
||||
static constexpr int MaxCompressionLevel() { return 2; }
|
||||
static constexpr int DefaultCompressionLevel() { return 1; }
|
||||
|
|
|
@ -31,12 +31,10 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "snappy-test.h"
|
||||
|
||||
#include "benchmark/benchmark.h"
|
||||
|
||||
#include "snappy-internal.h"
|
||||
#include "snappy-sinksource.h"
|
||||
#include "snappy-test.h"
|
||||
#include "snappy.h"
|
||||
#include "snappy_test_data.h"
|
||||
|
||||
|
@ -44,7 +42,7 @@ namespace snappy {
|
|||
|
||||
namespace {
|
||||
|
||||
void FilesAndLevels(::testing::Benchmark* benchmark) {
|
||||
void FilesAndLevels(benchmark::internal::Benchmark* benchmark) {
|
||||
for (int i = 0; i < ARRAYSIZE(kTestDataFiles); ++i) {
|
||||
for (int level = snappy::CompressionOptions::MinCompressionLevel();
|
||||
level <= snappy::CompressionOptions::MaxCompressionLevel(); ++level) {
|
||||
|
@ -64,8 +62,9 @@ void BM_UFlat(benchmark::State& state) {
|
|||
kTestDataFiles[file_index].size_limit);
|
||||
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{/*level=*/state.range(1)});
|
||||
snappy::Compress(
|
||||
contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{/*level=*/static_cast<int>(state.range(1))});
|
||||
char* dst = new char[contents.size()];
|
||||
|
||||
for (auto s : state) {
|
||||
|
@ -129,8 +128,9 @@ void BM_UValidate(benchmark::State& state) {
|
|||
kTestDataFiles[file_index].size_limit);
|
||||
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{/*level=*/state.range(1)});
|
||||
snappy::Compress(
|
||||
contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{/*level=*/static_cast<int>(state.range(1))});
|
||||
|
||||
for (auto s : state) {
|
||||
CHECK(snappy::IsValidCompressedBuffer(zcontents.data(), zcontents.size()));
|
||||
|
@ -226,7 +226,7 @@ void BM_UIOVecSink(benchmark::State& state) {
|
|||
// Uncompress into an iovec containing ten entries.
|
||||
const int kNumEntries = 10;
|
||||
struct iovec iov[kNumEntries];
|
||||
char *dst = new char[contents.size()];
|
||||
char* dst = new char[contents.size()];
|
||||
size_t used_so_far = 0;
|
||||
for (int i = 0; i < kNumEntries; ++i) {
|
||||
iov[i].iov_base = dst + used_so_far;
|
||||
|
@ -267,8 +267,9 @@ void BM_UFlatSink(benchmark::State& state) {
|
|||
kTestDataFiles[file_index].size_limit);
|
||||
|
||||
std::string zcontents;
|
||||
snappy::Compress(contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{/*level=*/state.range(1)});
|
||||
snappy::Compress(
|
||||
contents.data(), contents.size(), &zcontents,
|
||||
snappy::CompressionOptions{/*level=*/static_cast<int>(state.range(1))});
|
||||
char* dst = new char[contents.size()];
|
||||
|
||||
for (auto s : state) {
|
||||
|
@ -323,7 +324,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);
|
||||
|
|
Loading…
Reference in a new issue