Skip to content

Commit

Permalink
Move away from enum char value -1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
siying authored and tone.zhang committed Jul 13, 2016
1 parent 2ea2d92 commit 9142f29
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions HISTORY.md
@@ -1,6 +1,8 @@
# Unreleased
### Public API Change
* 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
* enum type #movebot Rocksdb Users Group and PerfLevel changes from char to unsigned char. Value of all PerfLevel shift by one.


# Rocksdb Change Log
Expand Down
2 changes: 1 addition & 1 deletion include/rocksdb/listener.h
Expand Up @@ -20,7 +20,7 @@ typedef std::unordered_map<std::string, std::shared_ptr<const TableProperties>>
class DB;
class Status;
struct CompactionJobStats;
enum CompressionType : char;
enum CompressionType : unsigned char;

enum class TableFileCreationReason {
kFlush,
Expand Down
4 changes: 2 additions & 2 deletions include/rocksdb/options.h
Expand Up @@ -52,7 +52,7 @@ class WalFilter;
// sequence of key,value pairs. Each block may be compressed before
// being stored in a file. The following enum describes which
// 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
// part of the persistent format on disk.
kNoCompression = 0x0,
Expand All @@ -66,7 +66,7 @@ enum CompressionType : char {
kZSTDNotFinalCompression = 0x40,

// kDisableCompressionOption is used to disable some compression options.
kDisableCompressionOption = -1,
kDisableCompressionOption = 0xff,
};

enum CompactionStyle : char {
Expand Down
14 changes: 7 additions & 7 deletions include/rocksdb/perf_level.h
Expand Up @@ -13,14 +13,14 @@ namespace rocksdb {

// How much perf stats to collect. Affects perf_context and iostats_context.

enum PerfLevel : char {
kUninitialized = -1, // unknown setting
kDisable = 0, // disable perf stats
kEnableCount = 1, // enable only count stats
kEnableTimeExceptForMutex = 2, // Other than count stats, also enable time
enum PerfLevel : unsigned char {
kUninitialized = 0, // unknown setting
kDisable = 1, // disable perf stats
kEnableCount = 2, // enable only count stats
kEnableTimeExceptForMutex = 3, // Other than count stats, also enable time
// stats except for mutexes
kEnableTime = 3, // enable count and time stats
kOutOfBounds = 4 // N.B. Must always be the last value!
kEnableTime = 4, // enable count and time stats
kOutOfBounds = 5 // N.B. Must always be the last value!
};

// set the perf stats level for current thread
Expand Down
2 changes: 1 addition & 1 deletion include/rocksdb/utilities/leveldb_options.h
Expand Up @@ -21,7 +21,7 @@ class Logger;
struct Options;
class Snapshot;

enum CompressionType : char;
enum CompressionType : unsigned char;

// Options to control the behavior of a database (passed to
// DB::Open). A LevelDBOptions object can be initialized as though
Expand Down

0 comments on commit 9142f29

Please sign in to comment.