From 4bcb7fb148a8d80ccedbd7447b2361481a42676a Mon Sep 17 00:00:00 2001 From: Souvik Banerjee Date: Tue, 12 Dec 2017 12:07:35 -0800 Subject: [PATCH] Update transaction_test_util.cc Summary: Fixes a compile error on gcc 7.2.1 (-Werror=format-truncation=). Closes https://github.com/facebook/rocksdb/pull/3248 Differential Revision: D6546515 Pulled By: yiwu-arbug fbshipit-source-id: bd78cca63f2af376faceccb1838d2d4cc9208fef --- util/transaction_test_util.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/transaction_test_util.cc b/util/transaction_test_util.cc index bb64124886..f95305196d 100644 --- a/util/transaction_test_util.cc +++ b/util/transaction_test_util.cc @@ -80,6 +80,7 @@ Status RandomTransactionInserter::DBGet( // four digits and zero end char char prefix_buf[5]; // Pad prefix appropriately so we can iterate over each set + assert(set_i + 1 <= 9999); snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", set_i + 1); // key format: [SET#][random#] std::string skey = ToString(ikey); @@ -263,6 +264,7 @@ Status RandomTransactionInserter::Verify(DB* db, uint16_t num_sets, for (uint16_t set_i : set_vec) { // four digits and zero end char char prefix_buf[5]; + assert(set_i + 1 <= 9999); snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", set_i + 1); uint64_t total = 0;