Skip to content

Commit

Permalink
Fix compiler warnings. Use uint64_t instead of uint.
Browse files Browse the repository at this point in the history
Summary: Fix compiler warnings. Use uint64_t instead of uint.

Test Plan: build using -Wall

Reviewers: heyongqiang

Reviewed By: heyongqiang

Differential Revision: https://reviews.facebook.net/D5355
  • Loading branch information
Dhruba Borthakur committed Sep 12, 2012
1 parent 0f43aa4 commit 407727b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion db/db_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions hdfs/env_hdfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;}

Expand Down
4 changes: 2 additions & 2 deletions include/leveldb/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tools/manifest_dump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion util/env_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 407727b

Please sign in to comment.