Fix compiler warnings. Use uint64_t instead of uint.
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
This commit is contained in:
parent
0f43aa474e
commit
407727b75f
@ -1150,7 +1150,7 @@ int main(int argc, char** argv) {
|
|||||||
} else if (sscanf(argv[i], "--disable_wal=%d%c", &n, &junk) == 1 &&
|
} else if (sscanf(argv[i], "--disable_wal=%d%c", &n, &junk) == 1 &&
|
||||||
(n == 0 || n == 1)) {
|
(n == 0 || n == 1)) {
|
||||||
FLAGS_disable_wal = n;
|
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);
|
FLAGS_env = new leveldb::HdfsEnv(hdfsname);
|
||||||
} else if (sscanf(argv[i], "--target_file_size_base=%d%c",
|
} else if (sscanf(argv[i], "--target_file_size_base=%d%c",
|
||||||
&n, &junk) == 1) {
|
&n, &junk) == 1) {
|
||||||
|
@ -160,7 +160,7 @@ DBImpl::DBImpl(const Options& options, const std::string& dbname)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char name[100];
|
char name[100];
|
||||||
Status st = env_->GetHostName(name, 100);
|
Status st = env_->GetHostName(name, 100L);
|
||||||
if(st.ok()) {
|
if(st.ok()) {
|
||||||
host_name_ = name;
|
host_name_ = name;
|
||||||
} else {
|
} else {
|
||||||
|
@ -122,7 +122,7 @@ class HdfsEnv : public Env {
|
|||||||
posixEnv->SleepForMicroseconds(micros);
|
posixEnv->SleepForMicroseconds(micros);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Status GetHostName(char* name, uint len) {
|
virtual Status GetHostName(char* name, uint64_t len) {
|
||||||
return posixEnv->GetHostName(name, len);
|
return posixEnv->GetHostName(name, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ class HdfsEnv : public Env {
|
|||||||
|
|
||||||
virtual void SleepForMicroseconds(int micros) {}
|
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;}
|
virtual Status GetCurrentTime(int64_t* unix_time) {return notsup;}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class Env {
|
|||||||
virtual void SleepForMicroseconds(int micros) = 0;
|
virtual void SleepForMicroseconds(int micros) = 0;
|
||||||
|
|
||||||
// Get the current host name.
|
// 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).
|
// Get the number of seconds since the Epoch, 1970-01-01 00:00:00 (UTC).
|
||||||
virtual Status GetCurrentTime(int64_t* unix_time) = 0;
|
virtual Status GetCurrentTime(int64_t* unix_time) = 0;
|
||||||
@ -334,7 +334,7 @@ class EnvWrapper : public Env {
|
|||||||
void SleepForMicroseconds(int micros) {
|
void SleepForMicroseconds(int micros) {
|
||||||
target_->SleepForMicroseconds(micros);
|
target_->SleepForMicroseconds(micros);
|
||||||
}
|
}
|
||||||
Status GetHostName(char* name, uint len) {
|
Status GetHostName(char* name, uint64_t len) {
|
||||||
return target_->GetHostName(name, len);
|
return target_->GetHostName(name, len);
|
||||||
}
|
}
|
||||||
Status GetCurrentTime(int64_t* unix_time) {
|
Status GetCurrentTime(int64_t* unix_time) {
|
||||||
|
@ -37,7 +37,7 @@ int main(int argc, char** argv) {
|
|||||||
if ((n = param.find("--file=")) != std::string::npos) {
|
if ((n = param.find("--file=")) != std::string::npos) {
|
||||||
manifestfile = param.substr(strlen("--file="));
|
manifestfile = param.substr(strlen("--file="));
|
||||||
foundfile = 1;
|
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)) {
|
(n == 0 || n == 1)) {
|
||||||
verbose = n;
|
verbose = n;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ class PosixEnv : public Env {
|
|||||||
usleep(micros);
|
usleep(micros);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Status GetHostName(char* name, uint len) {
|
virtual Status GetHostName(char* name, uint64_t len) {
|
||||||
int ret = gethostname(name, len);
|
int ret = gethostname(name, len);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EFAULT || errno == EINVAL)
|
if (errno == EFAULT || errno == EINVAL)
|
||||||
|
Loading…
Reference in New Issue
Block a user