From 4c181f08bca568efc42a9d90c612a7569bf9c388 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Sat, 30 May 2015 12:25:45 -0400 Subject: [PATCH] Fix compile on darwin Summary: As title Test Plan: make check Reviewers: anthony Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D39243 --- db/db_bench.cc | 6 ++++-- utilities/transactions/optimistic_transaction_impl.cc | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/db/db_bench.cc b/db/db_bench.cc index f8ebf91a8..b5fa4e277 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -3609,7 +3609,8 @@ class Benchmark { if (total != prev_total) { fprintf(stderr, "RandomTransactionVerify found inconsistent totals. " - "Set[%u]: %lu, Set[%u]: %lu \n", + "Set[%" PRIu32 "]: %" PRIu64 ", Set[%" PRIu32 "]: %" PRIu64 + " \n", i - 1, prev_total, i, total); abort(); } @@ -3617,7 +3618,8 @@ class Benchmark { prev_total = total; } - fprintf(stdout, "RandomTransactionVerify Success! Total:%lu\n", prev_total); + fprintf(stdout, "RandomTransactionVerify Success! Total:%" PRIu64 "\n", + prev_total); } void Compact(ThreadState* thread) { diff --git a/utilities/transactions/optimistic_transaction_impl.cc b/utilities/transactions/optimistic_transaction_impl.cc index 0571e83d9..cfb9fa660 100644 --- a/utilities/transactions/optimistic_transaction_impl.cc +++ b/utilities/transactions/optimistic_transaction_impl.cc @@ -7,6 +7,11 @@ #include "utilities/transactions/optimistic_transaction_impl.h" +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif + +#include #include #include @@ -304,9 +309,9 @@ Status OptimisticTransactionImpl::CheckTransactionForConflicts(DB* db) { char msg[255]; snprintf( msg, sizeof(msg), - "Could not commit transaction with write at SequenceNumber %lu " - "as the MemTable only contains changes newer than SequenceNumber " - "%lu.", + "Could not commit transaction with write at SequenceNumber %" PRIu64 + " as the MemTable only contains changes newer than SequenceNumber " + "%" PRIu64 ".", key_seq, earliest_seq); result = Status::Busy(msg); } else {