From a45e7581b71b950e3c352199dae75bc60ddbdeca Mon Sep 17 00:00:00 2001 From: sdong Date: Mon, 6 Apr 2015 11:33:01 -0700 Subject: [PATCH] Avoid naming conflict of EntryType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Fix build break on travis build: $ OPT=-DTRAVIS V=1 make unity && make clean && OPT=-DTRAVIS V=1 make db_test && ./db_test ...... In file included from unity.cc:65:0: ./table/plain_table_key_coding.cc: In member function ‘rocksdb::Status rocksdb::PlainTableKeyDecoder::NextPrefixEncodingKey(const char*, const char*, rocksdb::ParsedInternalKey*, rocksdb::Slice*, size_t*, bool*)’: ./table/plain_table_key_coding.cc:224:3: error: reference to ‘EntryType’ is ambiguous EntryType entry_type; ^ In file included from ./db/table_properties_collector.h:9:0, from ./db/builder.h:11, from ./db/builder.cc:10, from unity.cc:1: ./include/rocksdb/table_properties.h:81:6: note: candidates are: enum rocksdb::EntryType enum EntryType { ^ In file included from unity.cc:65:0: ./table/plain_table_key_coding.cc:16:6: note: enum rocksdb::{anonymous}::EntryType enum EntryType : unsigned char { ^ ./table/plain_table_key_coding.cc:231:51: error: ‘entry_type’ was not declared in this scope const char* pos = DecodeSize(key_ptr, limit, &entry_type, &size); ^ make: *** [unity.o] Error 1 Test Plan: OPT=-DTRAVIS V=1 make unity And make sure it doesn't break anymore. Reviewers: yhchiang, kradhakrishnan, igor Reviewed By: igor Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D36549 --- table/plain_table_key_coding.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/table/plain_table_key_coding.cc b/table/plain_table_key_coding.cc index a8967e8c8..4f09b507e 100644 --- a/table/plain_table_key_coding.cc +++ b/table/plain_table_key_coding.cc @@ -13,7 +13,7 @@ namespace rocksdb { namespace { -enum EntryType : unsigned char { +enum PlainTableEntryType : unsigned char { kFullKey = 0, kPrefixFromPreviousKey = 1, kKeySuffix = 2, @@ -27,7 +27,8 @@ enum EntryType : unsigned char { const unsigned char kSizeInlineLimit = 0x3F; // Return 0 for error -size_t EncodeSize(EntryType type, uint32_t key_size, char* out_buffer) { +size_t EncodeSize(PlainTableEntryType type, uint32_t key_size, + char* out_buffer) { out_buffer[0] = type << 6; if (key_size < static_cast(kSizeInlineLimit)) { @@ -43,9 +44,9 @@ size_t EncodeSize(EntryType type, uint32_t key_size, char* out_buffer) { // Return position after the size byte(s). nullptr means error const char* DecodeSize(const char* offset, const char* limit, - EntryType* entry_type, uint32_t* key_size) { + PlainTableEntryType* entry_type, uint32_t* key_size) { assert(offset < limit); - *entry_type = static_cast( + *entry_type = static_cast( (static_cast(offset[0]) & ~kSizeInlineLimit) >> 6); char inline_key_size = offset[0] & kSizeInlineLimit; if (inline_key_size < kSizeInlineLimit) { @@ -221,7 +222,7 @@ Status PlainTableKeyDecoder::NextPrefixEncodingKey( const char* start, const char* limit, ParsedInternalKey* parsed_key, Slice* internal_key, size_t* bytes_read, bool* seekable) { const char* key_ptr = start; - EntryType entry_type; + PlainTableEntryType entry_type; bool expect_suffix = false; do {