Fix status message size assert (#7045)
Summary: In status.cc, the assert is `assert(sizeof(msgs) > index)`; msgs is a const char* array, sizeof(msgs) is the array size*char* size, which will make the assert pass all the time. Change it to sizeof(msgs)/sizeof(char*) > index. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7045 Test Plan: pass make check Reviewed By: cheng-chang Differential Revision: D22291337 Pulled By: zhichao-cao fbshipit-source-id: 4ba8ebbb8da80ace7ca6adcdb0c66726f993659d
This commit is contained in:
parent
c7c7b07f06
commit
a9a973869a
@ -134,7 +134,7 @@ std::string Status::ToString() const {
|
||||
std::string result(type);
|
||||
if (subcode_ != kNone) {
|
||||
uint32_t index = static_cast<int32_t>(subcode_);
|
||||
assert(sizeof(msgs) > index);
|
||||
assert(sizeof(msgs) / sizeof(msgs[0]) > index);
|
||||
result.append(msgs[index]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user