diff --git a/env/env_hdfs.cc b/env/env_hdfs.cc index 5561f8ced..3323eeb8a 100644 --- a/env/env_hdfs.cc +++ b/env/env_hdfs.cc @@ -12,7 +12,6 @@ #define ROCKSDB_HDFS_FILE_C #include -#include #include #include #include @@ -124,8 +123,9 @@ class HdfsReadableFile : virtual public SequentialFile, Status s; ROCKS_LOG_DEBUG(mylog, "[hdfs] HdfsReadableFile preading %s\n", filename_.c_str()); - ssize_t bytes_read = hdfsPread(fileSys_, hfile_, offset, - (void*)scratch, (tSize)n); + tSize bytes_read = + hdfsPread(fileSys_, hfile_, offset, static_cast(scratch), + static_cast(n)); ROCKS_LOG_DEBUG(mylog, "[hdfs] HdfsReadableFile pread %s\n", filename_.c_str()); *result = Slice(scratch, (bytes_read < 0) ? 0 : bytes_read); diff --git a/hdfs/env_hdfs.h b/hdfs/env_hdfs.h index 07c00e41b..c56f8fe48 100644 --- a/hdfs/env_hdfs.h +++ b/hdfs/env_hdfs.h @@ -162,10 +162,7 @@ class HdfsEnv : public Env { return posixEnv->TimeToString(number); } - static uint64_t gettid() { - assert(sizeof(pthread_t) <= sizeof(uint64_t)); - return (uint64_t)pthread_self(); - } + static uint64_t gettid() { return Env::Default()->GetThreadID(); } uint64_t GetThreadID() const override { return HdfsEnv::gettid(); } @@ -209,8 +206,7 @@ class HdfsEnv : public Env { std::string portStr = (rem == 0 ? remaining : remaining.substr(0, rem)); - tPort port; - port = atoi(portStr.c_str()); + tPort port = static_cast(atoi(portStr.c_str())); if (port == 0) { throw HdfsFatalException("Bad host-port for hdfs " + uri); }