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
This commit is contained in:
Souvik Banerjee 2017-12-12 12:07:35 -08:00 committed by Facebook Github Bot
parent e3a06f12d2
commit 4bcb7fb148
1 changed files with 2 additions and 0 deletions

View File

@ -80,6 +80,7 @@ Status RandomTransactionInserter::DBGet(
// four digits and zero end char // four digits and zero end char
char prefix_buf[5]; char prefix_buf[5];
// Pad prefix appropriately so we can iterate over each set // 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); snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", set_i + 1);
// key format: [SET#][random#] // key format: [SET#][random#]
std::string skey = ToString(ikey); 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) { for (uint16_t set_i : set_vec) {
// four digits and zero end char // four digits and zero end char
char prefix_buf[5]; char prefix_buf[5];
assert(set_i + 1 <= 9999);
snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", set_i + 1); snprintf(prefix_buf, sizeof(prefix_buf), "%.4u", set_i + 1);
uint64_t total = 0; uint64_t total = 0;