utilities: Fix build failure with -Werror=maybe-uninitialized (#5074)

Summary:
Initialize magic_number to zero to avoid such failure.
utilities/blob_db/blob_log_format.cc:91:3: error: 'magic_number' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
   if (magic_number != kMagicNumber) {
   ^~

Signed-off-by: He Zhe <zhe.he@windriver.com>
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5074

Differential Revision: D14505514

Pulled By: miasantreble

fbshipit-source-id: 4334462958c2b9c5a7c68c6ab24dadf94ad70902
main
He Zhe 6 years ago committed by Facebook Github Bot
parent b4fa51dfaf
commit 20d49da90c
  1. 2
      utilities/blob_db/blob_log_format.cc

@ -82,7 +82,7 @@ Status BlobLogFooter::DecodeFrom(Slice src) {
uint32_t src_crc = 0; uint32_t src_crc = 0;
src_crc = crc32c::Value(src.data(), BlobLogFooter::kSize - sizeof(uint32_t)); src_crc = crc32c::Value(src.data(), BlobLogFooter::kSize - sizeof(uint32_t));
src_crc = crc32c::Mask(src_crc); src_crc = crc32c::Mask(src_crc);
uint32_t magic_number; uint32_t magic_number = 0;
if (!GetFixed32(&src, &magic_number) || !GetFixed64(&src, &blob_count) || if (!GetFixed32(&src, &magic_number) || !GetFixed64(&src, &blob_count) ||
!GetFixed64(&src, &expiration_range.first) || !GetFixed64(&src, &expiration_range.first) ||
!GetFixed64(&src, &expiration_range.second) || !GetFixed32(&src, &crc)) { !GetFixed64(&src, &expiration_range.second) || !GetFixed32(&src, &crc)) {

Loading…
Cancel
Save