fix clang analyzer error (#4583)
Summary: clang analyzer currently fails with the following warnings: > db/log_reader.cc:323:9: warning: Undefined or garbage value returned to caller return r; ^~~~~~~~ db/log_reader.cc:344:11: warning: Undefined or garbage value returned to caller return r; ^~~~~~~~ db/log_reader.cc:369:11: warning: Undefined or garbage value returned to caller return r; Pull Request resolved: https://github.com/facebook/rocksdb/pull/4583 Differential Revision: D10523517 Pulled By: miasantreble fbshipit-source-id: 0cc8b8f27657b202bead148bbe7c4aa84fed095b
This commit is contained in:
parent
c7a45ca91f
commit
f6b151f16d
@ -318,7 +318,10 @@ unsigned int Reader::ReadPhysicalRecord(Slice* result, size_t* drop_size) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
// We need at least the minimum header size
|
// We need at least the minimum header size
|
||||||
if (buffer_.size() < static_cast<size_t>(kHeaderSize)) {
|
if (buffer_.size() < static_cast<size_t>(kHeaderSize)) {
|
||||||
int r;
|
// the default value of r is meaningless because ReadMore will overwrite
|
||||||
|
// it if it returns false; in case it returns true, the return value will
|
||||||
|
// not be used anyway
|
||||||
|
int r = kEof;
|
||||||
if (!ReadMore(drop_size, &r)) {
|
if (!ReadMore(drop_size, &r)) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -339,7 +342,7 @@ unsigned int Reader::ReadPhysicalRecord(Slice* result, size_t* drop_size) {
|
|||||||
header_size = kRecyclableHeaderSize;
|
header_size = kRecyclableHeaderSize;
|
||||||
// We need enough for the larger header
|
// We need enough for the larger header
|
||||||
if (buffer_.size() < static_cast<size_t>(kRecyclableHeaderSize)) {
|
if (buffer_.size() < static_cast<size_t>(kRecyclableHeaderSize)) {
|
||||||
int r;
|
int r = kEof;
|
||||||
if (!ReadMore(drop_size, &r)) {
|
if (!ReadMore(drop_size, &r)) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@ -364,7 +367,7 @@ unsigned int Reader::ReadPhysicalRecord(Slice* result, size_t* drop_size) {
|
|||||||
return kBadHeader;
|
return kBadHeader;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int r;
|
int r = kEof;
|
||||||
if (!ReadMore(drop_size, &r)) {
|
if (!ReadMore(drop_size, &r)) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user