fix build on 32bit systems
Code had an assert that tests if sizeof(long) == sizeof(long long), which obviously fails on 32-bit architectures. I believe the assert is incorrect on any architecture, considering the following code is actually putting a long long in an _int_. I replaced it with code that checks if the value fits in an int. Signed-off-by: Tibault Damman <tibault.damman@basalte.be>
This commit is contained in:
parent
d94fddae0a
commit
011fdb4772
@ -2608,8 +2608,11 @@ bool readSnapshotBulkPayload(connection *conn, redisMaster *mi, rdbSaveInfo &rsi
|
|||||||
if (mi->parseState->depth() != 0)
|
if (mi->parseState->depth() != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
static_assert(sizeof(long) == sizeof(long long),"");
|
long long repl_stream_db = mi->parseState->getMetaDataLongLong("repl-stream-db");
|
||||||
rsi.repl_stream_db = mi->parseState->getMetaDataLongLong("repl-stream-db");
|
if (repl_stream_db < INT_MIN || repl_stream_db > INT_MAX) {
|
||||||
|
throw "Invalid repl_stream_db value";
|
||||||
|
}
|
||||||
|
rsi.repl_stream_db = static_cast<int>(repl_stream_db);
|
||||||
rsi.repl_offset = mi->parseState->getMetaDataLongLong("repl-offset");
|
rsi.repl_offset = mi->parseState->getMetaDataLongLong("repl-offset");
|
||||||
sds str = mi->parseState->getMetaDataStr("repl-id");
|
sds str = mi->parseState->getMetaDataStr("repl-id");
|
||||||
if (sdslen(str) == CONFIG_RUN_ID_SIZE) {
|
if (sdslen(str) == CONFIG_RUN_ID_SIZE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user