summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Mumford <cmumford@google.com>2019-05-09 08:37:48 -0700
committerChris Mumford <cmumford@google.com>2019-05-09 08:37:49 -0700
commit1aae5c9f29ea43ceca745efae012c4aa731e9374 (patch)
tree625885997cfedfa19d65e4ba990c7d4ebd67e7b0
parentb7b86baec9ce47569affc5db54a20a6cc520e0f0 (diff)
parent7d060117fa0d5cab7cb15b0cf127533bea9ffbc7 (diff)
downloadleveldb-1aae5c9f29ea43ceca745efae012c4aa731e9374.tar.gz
Merge pull request #411 from proller:assert1
PiperOrigin-RevId: 247424040
-rw-r--r--db/dbformat.h6
-rw-r--r--db/version_edit.cc3
2 files changed, 6 insertions, 3 deletions
diff --git a/db/dbformat.h b/db/dbformat.h
index 013028a..f990040 100644
--- a/db/dbformat.h
+++ b/db/dbformat.h
@@ -139,7 +139,11 @@ class InternalKey {
AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t));
}
- void DecodeFrom(const Slice& s) { rep_.assign(s.data(), s.size()); }
+ bool DecodeFrom(const Slice& s) {
+ rep_.assign(s.data(), s.size());
+ return !rep_.empty();
+ }
+
Slice Encode() const {
assert(!rep_.empty());
return rep_;
diff --git a/db/version_edit.cc b/db/version_edit.cc
index 2385e7d..cd770ef 100644
--- a/db/version_edit.cc
+++ b/db/version_edit.cc
@@ -86,8 +86,7 @@ void VersionEdit::EncodeTo(std::string* dst) const {
static bool GetInternalKey(Slice* input, InternalKey* dst) {
Slice str;
if (GetLengthPrefixedSlice(input, &str)) {
- dst->DecodeFrom(str);
- return true;
+ return dst->DecodeFrom(str);
} else {
return false;
}