Skip to content

Commit 5f6feba

Browse files
authored
Fix a signed/unsigned comparison (#7639)
This triggers a warning in newer versions of GCC and causes compilation to fail with `-Werror`. #no-changelog
1 parent 2f21a7f commit 5f6feba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Firestore/core/src/local/leveldb_persistence.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ StatusOr<int64_t> LevelDbPersistence::CalculateByteSize() {
196196
int64_t file_size = maybe_size.ValueOrDie();
197197
count += file_size;
198198

199-
if (count < old_count || count > std::numeric_limits<int64_t>::max()) {
199+
auto max_signed_value =
200+
static_cast<uint64_t>(std::numeric_limits<int64_t>::max());
201+
if (count < old_count || count > max_signed_value) {
200202
return Status(Error::kErrorOutOfRange,
201203
"Failed to size LevelDB: count overflowed");
202204
}

0 commit comments

Comments
 (0)