Move away from enum char value -1

Summary: char is not signed in some platforms. Having negative values confuse those compilers.

Test Plan: Run all existing tests.

Reviewers: andrewkr, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: leveldb, andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D59619
main
sdong 9 years ago
parent 812dbfb483
commit 0babce57f7
  1. 1
      HISTORY.md
  2. 2
      include/rocksdb/listener.h
  3. 4
      include/rocksdb/options.h
  4. 14
      include/rocksdb/perf_level.h
  5. 2
      include/rocksdb/utilities/leveldb_options.h

@ -3,6 +3,7 @@
### Public API Change ### Public API Change
* Deprecate BlockBaseTableOptions.hash_index_allow_collision=false * Deprecate BlockBaseTableOptions.hash_index_allow_collision=false
* options.memtable_prefix_bloom_bits changes to options.memtable_prefix_bloom_bits_ratio and deprecate options.memtable_prefix_bloom_probes * options.memtable_prefix_bloom_bits changes to options.memtable_prefix_bloom_bits_ratio and deprecate options.memtable_prefix_bloom_probes
* enum type #movebot Rocksdb Users Group and PerfLevel changes from char to unsigned char. Value of all PerfLevel shift by one.
### New Features ### New Features
* Add avoid_flush_during_recovery option. * Add avoid_flush_during_recovery option.

@ -20,7 +20,7 @@ typedef std::unordered_map<std::string, std::shared_ptr<const TableProperties>>
class DB; class DB;
class Status; class Status;
struct CompactionJobStats; struct CompactionJobStats;
enum CompressionType : char; enum CompressionType : unsigned char;
enum class TableFileCreationReason { enum class TableFileCreationReason {
kFlush, kFlush,

@ -52,7 +52,7 @@ class WalFilter;
// sequence of key,value pairs. Each block may be compressed before // sequence of key,value pairs. Each block may be compressed before
// being stored in a file. The following enum describes which // being stored in a file. The following enum describes which
// compression method (if any) is used to compress a block. // compression method (if any) is used to compress a block.
enum CompressionType : char { enum CompressionType : unsigned char {
// NOTE: do not change the values of existing entries, as these are // NOTE: do not change the values of existing entries, as these are
// part of the persistent format on disk. // part of the persistent format on disk.
kNoCompression = 0x0, kNoCompression = 0x0,
@ -66,7 +66,7 @@ enum CompressionType : char {
kZSTDNotFinalCompression = 0x40, kZSTDNotFinalCompression = 0x40,
// kDisableCompressionOption is used to disable some compression options. // kDisableCompressionOption is used to disable some compression options.
kDisableCompressionOption = -1, kDisableCompressionOption = 0xff,
}; };
enum CompactionStyle : char { enum CompactionStyle : char {

@ -13,14 +13,14 @@ namespace rocksdb {
// How much perf stats to collect. Affects perf_context and iostats_context. // How much perf stats to collect. Affects perf_context and iostats_context.
enum PerfLevel : char { enum PerfLevel : unsigned char {
kUninitialized = -1, // unknown setting kUninitialized = 0, // unknown setting
kDisable = 0, // disable perf stats kDisable = 1, // disable perf stats
kEnableCount = 1, // enable only count stats kEnableCount = 2, // enable only count stats
kEnableTimeExceptForMutex = 2, // Other than count stats, also enable time kEnableTimeExceptForMutex = 3, // Other than count stats, also enable time
// stats except for mutexes // stats except for mutexes
kEnableTime = 3, // enable count and time stats kEnableTime = 4, // enable count and time stats
kOutOfBounds = 4 // N.B. Must always be the last value! kOutOfBounds = 5 // N.B. Must always be the last value!
}; };
// set the perf stats level for current thread // set the perf stats level for current thread

@ -21,7 +21,7 @@ class Logger;
struct Options; struct Options;
class Snapshot; class Snapshot;
enum CompressionType : char; enum CompressionType : unsigned char;
// Options to control the behavior of a database (passed to // Options to control the behavior of a database (passed to
// DB::Open). A LevelDBOptions object can be initialized as though // DB::Open). A LevelDBOptions object can be initialized as though

Loading…
Cancel
Save