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:
Tibault Damman 2024-01-15 16:48:02 +01:00 committed by John Sully
parent d94fddae0a
commit 011fdb4772

View File

@ -2608,8 +2608,11 @@ bool readSnapshotBulkPayload(connection *conn, redisMaster *mi, rdbSaveInfo &rsi
if (mi->parseState->depth() != 0)
return false;
static_assert(sizeof(long) == sizeof(long long),"");
rsi.repl_stream_db = mi->parseState->getMetaDataLongLong("repl-stream-db");
long long 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");
sds str = mi->parseState->getMetaDataStr("repl-id");
if (sdslen(str) == CONFIG_RUN_ID_SIZE) {