From 5ef27dea332a62c05707d3265864319f7eee603c Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Mon, 14 Oct 2019 22:12:31 -0700 Subject: [PATCH] Fix clang analyzer error (#5924) Summary: Without this PR, clang analyzer complains. ``` $USE_CLANG=1 make analyze db/compaction/compaction_job_test.cc:161:20: warning: The left operand of '==' is a garbage value if (key.type == kTypeBlobIndex) { ~~~~~~~~ ^ 1 warning generated. ``` Test Plan (on devserver) ``` $USE_CLANG=1 make analyze ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/5924 Differential Revision: D17923226 Pulled By: riversand963 fbshipit-source-id: 9d1eb769b5e0de7cb3d89dc90d1cfa895db7fdc8 --- db/compaction/compaction_job_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/compaction/compaction_job_test.cc b/db/compaction/compaction_job_test.cc index ad2fbfa8d..5e0191734 100644 --- a/db/compaction/compaction_job_test.cc +++ b/db/compaction/compaction_job_test.cc @@ -140,7 +140,7 @@ class CompactionJobTest : public testing::Test { std::string skey; std::string value; std::tie(skey, value) = kv; - ParseInternalKey(skey, &key); + bool parsed = ParseInternalKey(skey, &key); smallest_seqno = std::min(smallest_seqno, key.sequence); largest_seqno = std::max(largest_seqno, key.sequence); @@ -158,7 +158,7 @@ class CompactionJobTest : public testing::Test { first_key = false; - if (key.type == kTypeBlobIndex) { + if (parsed && key.type == kTypeBlobIndex) { BlobIndex blob_index; const Status s = blob_index.DecodeFrom(value); if (!s.ok()) {