From 8dfe2fdd51cee18fcc167d694cf90d0979165800 Mon Sep 17 00:00:00 2001 From: ZHANG Biao Date: Thu, 14 Aug 2014 20:01:01 +0800 Subject: [PATCH] fix compile error under Mac OS X --- util/db_info_dummper.cc | 10 ++++++---- util/env_posix.cc | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/util/db_info_dummper.cc b/util/db_info_dummper.cc index c428617d8..d5dd97ad2 100644 --- a/util/db_info_dummper.cc +++ b/util/db_info_dummper.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 #include #include #include @@ -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(" ;"); } diff --git a/util/env_posix.cc b/util/env_posix.cc index 94d1f61c9..f9bfc697d 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -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); }