diff --git a/db/db_bench.cc b/db/db_bench.cc index 623ba6a94..b99cac32f 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -1150,7 +1150,7 @@ int main(int argc, char** argv) { } else if (sscanf(argv[i], "--disable_wal=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) { FLAGS_disable_wal = n; - } else if (sscanf(argv[i], "--hdfs=%s", &hdfsname) == 1) { + } else if (sscanf(argv[i], "--hdfs=%s", hdfsname) == 1) { FLAGS_env = new leveldb::HdfsEnv(hdfsname); } else if (sscanf(argv[i], "--target_file_size_base=%d%c", &n, &junk) == 1) { diff --git a/db/db_impl.cc b/db/db_impl.cc index 18d51baca..abf17a0b7 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -160,7 +160,7 @@ DBImpl::DBImpl(const Options& options, const std::string& dbname) #endif char name[100]; - Status st = env_->GetHostName(name, 100); + Status st = env_->GetHostName(name, 100L); if(st.ok()) { host_name_ = name; } else { diff --git a/hdfs/env_hdfs.h b/hdfs/env_hdfs.h index 4876b1dc3..4ec1b1f5d 100644 --- a/hdfs/env_hdfs.h +++ b/hdfs/env_hdfs.h @@ -122,7 +122,7 @@ class HdfsEnv : public Env { posixEnv->SleepForMicroseconds(micros); } - virtual Status GetHostName(char* name, uint len) { + virtual Status GetHostName(char* name, uint64_t len) { return posixEnv->GetHostName(name, len); } @@ -262,7 +262,7 @@ class HdfsEnv : public Env { virtual void SleepForMicroseconds(int micros) {} - virtual Status GetHostName(char* name, uint len) {return notsup;} + virtual Status GetHostName(char* name, uint64_t len) {return notsup;} virtual Status GetCurrentTime(int64_t* unix_time) {return notsup;} diff --git a/include/leveldb/env.h b/include/leveldb/env.h index 2d045cc1d..a0e443af4 100644 --- a/include/leveldb/env.h +++ b/include/leveldb/env.h @@ -146,7 +146,7 @@ class Env { virtual void SleepForMicroseconds(int micros) = 0; // Get the current host name. - virtual Status GetHostName(char* name, uint len) = 0; + virtual Status GetHostName(char* name, uint64_t len) = 0; // Get the number of seconds since the Epoch, 1970-01-01 00:00:00 (UTC). virtual Status GetCurrentTime(int64_t* unix_time) = 0; @@ -334,7 +334,7 @@ class EnvWrapper : public Env { void SleepForMicroseconds(int micros) { target_->SleepForMicroseconds(micros); } - Status GetHostName(char* name, uint len) { + Status GetHostName(char* name, uint64_t len) { return target_->GetHostName(name, len); } Status GetCurrentTime(int64_t* unix_time) { diff --git a/tools/manifest_dump.cc b/tools/manifest_dump.cc index 3268f1053..d8b0a9e0c 100644 --- a/tools/manifest_dump.cc +++ b/tools/manifest_dump.cc @@ -37,7 +37,7 @@ int main(int argc, char** argv) { if ((n = param.find("--file=")) != std::string::npos) { manifestfile = param.substr(strlen("--file=")); foundfile = 1; - } else if (sscanf(argv[i], "--verbose=%d%c", &n, &junk) == 1 && + } else if (sscanf(argv[i], "--verbose=%ld%c", &n, &junk) == 1 && (n == 0 || n == 1)) { verbose = n; } diff --git a/util/env_posix.cc b/util/env_posix.cc index ee294e472..439d215db 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -553,7 +553,7 @@ class PosixEnv : public Env { usleep(micros); } - virtual Status GetHostName(char* name, uint len) { + virtual Status GetHostName(char* name, uint64_t len) { int ret = gethostname(name, len); if (ret < 0) { if (errno == EFAULT || errno == EINVAL)