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
main
Andres Notzli 9 years ago
parent 6bdc484fd8
commit 0ccf2db385
  1. 8
      util/ldb_cmd.cc

@ -6,6 +6,12 @@
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
#include "util/ldb_cmd.h" #include "util/ldb_cmd.h"
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#include "db/dbformat.h" #include "db/dbformat.h"
#include "db/db_impl.h" #include "db/db_impl.h"
#include "db/log_reader.h" #include "db/log_reader.h"
@ -609,7 +615,7 @@ void ManifestDumpCommand::DoCommand() {
while ((entry = readdir(d.get())) != nullptr) { while ((entry = readdir(d.get())) != nullptr) {
unsigned int match; unsigned int match;
uint64_t num; 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)) { match == strlen(entry->d_name)) {
if (!found) { if (!found) {
manifestfile = db_path_ + "/" + std::string(entry->d_name); manifestfile = db_path_ + "/" + std::string(entry->d_name);

Loading…
Cancel
Save