Fix public API dependency on internal codes and dependency on MAX_INT32

Summary:
Public API depends on port/port.h which is wrong. Fix it.
Also with gcc 4.8.1 build was broken as MAX_INT32 was not recognized. Fix it by using ::max in linux.

Test Plan: Build it and try to build an external project on top of it.

Reviewers: anthony, yhchiang, kradhakrishnan, igor

Reviewed By: igor

Subscribers: yoshinorim, leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D41745
This commit is contained in:
sdong 2015-07-11 09:54:33 -07:00
parent 5fd11853cb
commit 76d3cd3286
10 changed files with 10 additions and 9 deletions

View File

@ -684,7 +684,7 @@ class DBImpl : public DB {
static const int KEEP_LOG_FILE_NUM = 1000;
// MSVC version 1800 still does not have constexpr for ::max()
static const uint64_t kNoTimeOut = UINT64_MAX;
static const uint64_t kNoTimeOut = port::kMaxUint64;
std::string db_absolute_path_;

View File

@ -60,7 +60,7 @@ class FileIndexer {
enum {
// MSVC version 1800 still does not have constexpr for ::max()
kLevelMaxIndex = rocksdb::port::LevelMaxIndex
kLevelMaxIndex = rocksdb::port::kMaxInt32
};
private:

View File

@ -18,7 +18,7 @@ namespace rocksdb {
class WriteThread {
public:
static const uint64_t kNoTimeOut = UINT64_MAX;
static const uint64_t kNoTimeOut = port::kMaxUint64;
// Information kept for every waiting writer
struct Writer {
Status status;

View File

@ -23,7 +23,6 @@
#include "rocksdb/transaction_log.h"
#include "rocksdb/listener.h"
#include "rocksdb/thread_status.h"
#include "port/port.h"
namespace rocksdb {

View File

@ -25,7 +25,6 @@
#include <vector>
#include "rocksdb/status.h"
#include "rocksdb/thread_status.h"
#include "port/port.h"
#ifdef GetCurrentTime
#undef GetCurrentTime

View File

@ -10,7 +10,6 @@
#include <string>
#include "rocksdb/perf_level.h"
#include "port/port.h"
namespace rocksdb {

View File

@ -77,7 +77,8 @@ namespace rocksdb {
namespace port {
// For use at db/file_indexer.h kLevelMaxIndex
const int LevelMaxIndex = std::numeric_limits<int32_t>::max();
const int kMaxInt32 = std::numeric_limits<int32_t>::max();
const uint64_t kMaxUint64 = std::numeric_limits<uint64_t>::max();
static const bool kLittleEndian = PLATFORM_IS_LITTLE_ENDIAN;
#undef PLATFORM_IS_LITTLE_ENDIAN

View File

@ -81,7 +81,8 @@ namespace port
{
// For use at db/file_indexer.h kLevelMaxIndex
const int LevelMaxIndex = INT32_MAX;
const int kMaxInt32 = INT32_MAX;
const uint64_t kMaxUint64 = UINT64_MAX;
const bool kLittleEndian = true;

View File

@ -10,6 +10,7 @@
#include <string>
#include <utility>
#include <vector>
#include "port/port.h"
#include "rocksdb/status.h"
#include "table/table_builder.h"
#include "rocksdb/table.h"
@ -68,7 +69,7 @@ class CuckooTableBuilder: public TableBuilder {
// We assume number of items is <= 2^32.
uint32_t make_space_for_key_call_id;
};
static const uint32_t kMaxVectorIdx = INT32_MAX;
static const uint32_t kMaxVectorIdx = port::kMaxInt32;
bool MakeSpaceForKey(const autovector<uint64_t>& hash_vals,
const uint32_t call_id,

View File

@ -11,6 +11,7 @@
#include <limits>
#include <cassert>
#include <string>
#include "port/port.h"
#include "rocksdb/env.h"
#include "rocksdb/options.h"
#include "rocksdb/immutable_options.h"