Skip to content

Commit 625b9ef

Browse files
author
Lei Jin
committed
Merge pull request XRPLF#234 from bbiao/master
fix compile error under Mac OS X
2 parents 59a2763 + 8dfe2fd commit 625b9ef

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

util/db_info_dummper.cc

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// Must not be included from any .h files to avoid polluting the namespace
77
// with macros.
88

9+
#define __STDC_FORMAT_MACROS
10+
#include <inttypes.h>
911
#include <stdio.h>
1012
#include <string>
1113
#include <algorithm>
@@ -50,13 +52,13 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
5052
break;
5153
case kDescriptorFile:
5254
env->GetFileSize(dbname + "/" + file, &file_size);
53-
Log(options.info_log, "MANIFEST file: %s size: %lu Bytes\n",
55+
Log(options.info_log, "MANIFEST file: %s size: %" PRIu64 " Bytes\n",
5456
file.c_str(), file_size);
5557
break;
5658
case kLogFile:
5759
env->GetFileSize(dbname + "/" + file, &file_size);
5860
char str[8];
59-
snprintf(str, sizeof(str), "%lu", file_size);
61+
snprintf(str, sizeof(str), "%" PRIu64, file_size);
6062
wal_info.append(file).append(" size: ").
6163
append(str, sizeof(str)).append(" ;");
6264
break;
@@ -87,7 +89,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
8789
}
8890
}
8991
}
90-
Log(options.info_log, "SST files in %s dir, Total Num: %lu, files: %s\n",
92+
Log(options.info_log, "SST files in %s dir, Total Num: %" PRIu64 ", files: %s\n",
9193
db_path.path.c_str(), file_num, file_info.c_str());
9294
file_num = 0;
9395
file_info.clear();
@@ -106,7 +108,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) {
106108
if (type == kLogFile) {
107109
env->GetFileSize(options.wal_dir + "/" + file, &file_size);
108110
char str[8];
109-
snprintf(str, sizeof(str), "%lu", file_size);
111+
snprintf(str, sizeof(str), "%" PRIu64, file_size);
110112
wal_info.append(file).append(" size: ").
111113
append(str, sizeof(str)).append(" ;");
112114
}

util/env_posix.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,8 @@ class PosixEnv : public Env {
15871587
IOPRIO_PRIO_VALUE(3, 0));
15881588
low_io_priority = true;
15891589
}
1590+
#else
1591+
(void)decrease_io_priority; // avoid 'unused variable' error
15901592
#endif
15911593
(*function)(arg);
15921594
}

0 commit comments

Comments
 (0)