MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rdbLoadCheckModuleValue

Function rdbLoadCheckModuleValue

app/redis-6.2.6/src/rdb.c:1488–1521  ·  view source on GitHub ↗

This function is called by rdbLoadObject() when the code is in RDB-check * mode and we find a module value of type 2 that can be parsed without * the need of the actual module. The value is parsed for errors, finally * a dummy redis object is returned just to conform to the API. */

Source from the content-addressed store, hash-verified

1486 * the need of the actual module. The value is parsed for errors, finally
1487 * a dummy redis object is returned just to conform to the API. */
1488robj *rdbLoadCheckModuleValue(rio *rdb, char *modulename) {
1489 uint64_t opcode;
1490 while((opcode = rdbLoadLen(rdb,NULL)) != RDB_MODULE_OPCODE_EOF) {
1491 if (opcode == RDB_MODULE_OPCODE_SINT ||
1492 opcode == RDB_MODULE_OPCODE_UINT)
1493 {
1494 uint64_t len;
1495 if (rdbLoadLenByRef(rdb,NULL,&len) == -1) {
1496 rdbReportCorruptRDB(
1497 "Error reading integer from module %s value", modulename);
1498 }
1499 } else if (opcode == RDB_MODULE_OPCODE_STRING) {
1500 robj *o = rdbGenericLoadStringObject(rdb,RDB_LOAD_NONE,NULL);
1501 if (o == NULL) {
1502 rdbReportCorruptRDB(
1503 "Error reading string from module %s value", modulename);
1504 }
1505 decrRefCount(o);
1506 } else if (opcode == RDB_MODULE_OPCODE_FLOAT) {
1507 float val;
1508 if (rdbLoadBinaryFloatValue(rdb,&val) == -1) {
1509 rdbReportCorruptRDB(
1510 "Error reading float from module %s value", modulename);
1511 }
1512 } else if (opcode == RDB_MODULE_OPCODE_DOUBLE) {
1513 double val;
1514 if (rdbLoadBinaryDoubleValue(rdb,&val) == -1) {
1515 rdbReportCorruptRDB(
1516 "Error reading double from module %s value", modulename);
1517 }
1518 }
1519 }
1520 return createStringObject("module-dummy-value",18);
1521}
1522
1523/* Load a Redis object of the specified type from the specified file.
1524 * On success a newly allocated object is returned, otherwise NULL.

Callers 3

rdbLoadObjectFunction · 0.85
rdbLoadRioFunction · 0.85
redis_check_rdbFunction · 0.85

Calls 7

rdbLoadLenFunction · 0.85
rdbLoadLenByRefFunction · 0.85
decrRefCountFunction · 0.85
rdbLoadBinaryFloatValueFunction · 0.85
rdbLoadBinaryDoubleValueFunction · 0.85
createStringObjectFunction · 0.70

Tested by

no test coverage detected