From 0ccf2db385a73370fe4503ba4b2847e8dc9f399d Mon Sep 17 00:00:00 2001 From: Andres Notzli Date: Tue, 8 Sep 2015 15:46:16 -0700 Subject: [PATCH] Fixed broken build due to format specifier Summary: Clang expects %llu for uint64_t, while gcc expects %lu. Replaced the format specifier with a format macro. This should fix the build on gcc and Clang. Test Plan: Build on gcc and clang. Reviewers: rven, anthony, yhchiang, sdong, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D46431 --- util/ldb_cmd.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index 33d9a3111..a441d7167 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -6,6 +6,12 @@ #ifndef ROCKSDB_LITE #include "util/ldb_cmd.h" +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif + +#include + #include "db/dbformat.h" #include "db/db_impl.h" #include "db/log_reader.h" @@ -609,7 +615,7 @@ void ManifestDumpCommand::DoCommand() { while ((entry = readdir(d.get())) != nullptr) { unsigned int match; uint64_t num; - if (sscanf(entry->d_name, "MANIFEST-%lu%n", &num, &match) && + if (sscanf(entry->d_name, "MANIFEST-%" PRIu64 "%n", &num, &match) && match == strlen(entry->d_name)) { if (!found) { manifestfile = db_path_ + "/" + std::string(entry->d_name);