From eeb3cf3f58385eac17654fcfeaf288e568673db8 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Sat, 11 Apr 2020 22:02:17 -0700 Subject: [PATCH] Fix release build (#6690) Summary: Fix release build caused by variable defined but unused. Test plan (devserver) ``` make release ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/6690 Reviewed By: cheng-chang Differential Revision: D20980571 Pulled By: riversand963 fbshipit-source-id: c3f3b13f81dce4bdb19876dc2e710d5902ff8a02 --- db/db_with_timestamp_basic_test.cc | 16 +--------------- test_util/testutil.cc | 6 ++---- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/db/db_with_timestamp_basic_test.cc b/db/db_with_timestamp_basic_test.cc index 46687a5bc..59b5d4a17 100644 --- a/db/db_with_timestamp_basic_test.cc +++ b/db/db_with_timestamp_basic_test.cc @@ -26,22 +26,8 @@ class DBBasicTestWithTimestampBase : public DBTestBase { protected: static std::string Key1(uint64_t k) { - uint32_t x = 1; - const bool is_little_endian = (*reinterpret_cast(&x) != 0); std::string ret; - if (is_little_endian) { - ret.assign(reinterpret_cast(&k), sizeof(k)); - } else { - ret.resize(sizeof(k)); - ret[0] = k & 0xff; - ret[1] = (k >> 8) & 0xff; - ret[2] = (k >> 16) & 0xff; - ret[3] = (k >> 24) & 0xff; - ret[4] = (k >> 32) & 0xff; - ret[5] = (k >> 40) & 0xff; - ret[6] = (k >> 48) & 0xff; - ret[7] = (k >> 56) & 0xff; - } + PutFixed64(&ret, k); std::reverse(ret.begin(), ret.end()); return ret; } diff --git a/test_util/testutil.cc b/test_util/testutil.cc index f9f5468e6..86811f71f 100644 --- a/test_util/testutil.cc +++ b/test_util/testutil.cc @@ -154,10 +154,8 @@ class ComparatorWithU64TsImpl : public Comparator { return cmp_without_ts_->Compare(lhs, rhs); } int CompareTimestamp(const Slice& ts1, const Slice& ts2) const override { - size_t ts_sz = timestamp_size(); - assert(ts1.size() == ts_sz); - assert(ts2.size() == ts_sz); - assert(ts_sz == sizeof(uint64_t)); + assert(ts1.size() == sizeof(uint64_t)); + assert(ts2.size() == sizeof(uint64_t)); uint64_t lhs = DecodeFixed64(ts1.data()); uint64_t rhs = DecodeFixed64(ts2.data()); if (lhs < rhs) {