Skip to content

Commit ac69108

Browse files
committed
Merge pull request #1249 from victorvianna:main
PiperOrigin-RevId: 721407764
2 parents e829478 + 4ee78d7 commit ac69108

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/leveldb/slice.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class LEVELDB_EXPORT Slice {
5151
// Return true iff the length of the referenced data is zero
5252
bool empty() const { return size_ == 0; }
5353

54+
const char* begin() const { return data(); }
55+
const char* end() const { return data() + size(); }
56+
5457
// Return the ith byte in the referenced data.
5558
// REQUIRES: n < size()
5659
char operator[](size_t n) const {

util/hash.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ uint32_t Hash(const char* data, size_t n, uint32_t seed) {
2727
uint32_t h = seed ^ (n * m);
2828

2929
// Pick up four bytes at a time
30-
while (data + 4 <= limit) {
30+
while (limit - data >= 4) {
3131
uint32_t w = DecodeFixed32(data);
3232
data += 4;
3333
h += w;

0 commit comments

Comments
 (0)