diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-12-01 16:14:45 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-12-01 16:14:45 -0800 |
commit | 605d701471c3ee84682b0c149e41142d7cea95e7 (patch) | |
tree | 7a6af0e78ee2202f510686e9a3561c28829b8a4b /src/leveldb/db/log_writer.cc | |
parent | dc6dee41f7cf2ba93fcd0fea7c157e4b2775d439 (diff) | |
parent | 634ad517037b319147816f1d112b066528e1724a (diff) |
Merge in LevelDB 1.19 changes
Diffstat (limited to 'src/leveldb/db/log_writer.cc')
-rw-r--r-- | src/leveldb/db/log_writer.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/leveldb/db/log_writer.cc b/src/leveldb/db/log_writer.cc index 2da99ac088..74a03270da 100644 --- a/src/leveldb/db/log_writer.cc +++ b/src/leveldb/db/log_writer.cc @@ -12,15 +12,24 @@ namespace leveldb { namespace log { -Writer::Writer(WritableFile* dest) - : dest_(dest), - block_offset_(0) { +static void InitTypeCrc(uint32_t* type_crc) { for (int i = 0; i <= kMaxRecordType; i++) { char t = static_cast<char>(i); - type_crc_[i] = crc32c::Value(&t, 1); + type_crc[i] = crc32c::Value(&t, 1); } } +Writer::Writer(WritableFile* dest) + : dest_(dest), + block_offset_(0) { + InitTypeCrc(type_crc_); +} + +Writer::Writer(WritableFile* dest, uint64_t dest_length) + : dest_(dest), block_offset_(dest_length % kBlockSize) { + InitTypeCrc(type_crc_); +} + Writer::~Writer() { } |