fix compile error under Mac OS X

main
ZHANG Biao 10 years ago
parent 58c49466d2
commit 8dfe2fdd51
  1. 10
      util/db_info_dummper.cc
  2. 2
      util/env_posix.cc

@ -6,6 +6,8 @@
// Must not be included from any .h files to avoid polluting the namespace
// with macros.
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdio.h>
#include <string>
#include <algorithm>
@ -50,13 +52,13 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
break;
case kDescriptorFile:
env->GetFileSize(dbname + "/" + file, &file_size);
Log(options.info_log, "MANIFEST file: %s size: %lu Bytes\n",
Log(options.info_log, "MANIFEST file: %s size: %" PRIu64 " Bytes\n",
file.c_str(), file_size);
break;
case kLogFile:
env->GetFileSize(dbname + "/" + file, &file_size);
char str[8];
snprintf(str, sizeof(str), "%lu", file_size);
snprintf(str, sizeof(str), "%" PRIu64, file_size);
wal_info.append(file).append(" size: ").
append(str, sizeof(str)).append(" ;");
break;
@ -87,7 +89,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
}
}
}
Log(options.info_log, "SST files in %s dir, Total Num: %lu, files: %s\n",
Log(options.info_log, "SST files in %s dir, Total Num: %" PRIu64 ", files: %s\n",
db_path.path.c_str(), file_num, file_info.c_str());
file_num = 0;
file_info.clear();
@ -106,7 +108,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
if (type == kLogFile) {
env->GetFileSize(options.wal_dir + "/" + file, &file_size);
char str[8];
snprintf(str, sizeof(str), "%lu", file_size);
snprintf(str, sizeof(str), "%" PRIu64, file_size);
wal_info.append(file).append(" size: ").
append(str, sizeof(str)).append(" ;");
}

@ -1587,6 +1587,8 @@ class PosixEnv : public Env {
IOPRIO_PRIO_VALUE(3, 0));
low_io_priority = true;
}
#else
(void)decrease_io_priority; // avoid 'unused variable' error
#endif
(*function)(arg);
}

Loading…
Cancel
Save