From 009a2270082606011d4f272127dbc3409f9d105a Mon Sep 17 00:00:00 2001 From: Moti Cohen Date: Thu, 11 Jul 2024 11:15:01 +0300 Subject: [PATCH] PR review fixes --- src/lib/parser.c | 10 +++++----- src/lib/parserRaw.c | 16 +++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/lib/parser.c b/src/lib/parser.c index 24d810a..9fd0953 100644 --- a/src/lib/parser.c +++ b/src/lib/parser.c @@ -12,7 +12,7 @@ * in the README.md file as an introduction to this file implementation. */ -#include +#include #include #include #include @@ -1698,7 +1698,7 @@ RdbStatus elementHash(RdbParser *p) { case ST_HASH_HEADER: if (p->currOpcode == RDB_TYPE_HASH_METADATA) { /* digest min HFE expiration time. No need to pass it to handlers - each field goanna report its expiration time anyway */ + as each field will report its own expiration time anyway */ BulkInfo *binfoExpire; IF_NOT_OK_RETURN(rdbLoad(p, 8, RQ_ALLOC, NULL, &binfoExpire)); } @@ -1770,7 +1770,7 @@ RdbStatus elementHashLPEx(RdbParser *p) { if (p->currOpcode != RDB_TYPE_HASH_LISTPACK_EX_PRE_GA) { /* digest min HFE expiration time. No need to pass it to handlers - each field goanna report its expiration time anyway */ + as each field will report its own expiration time anyway */ BulkInfo *binfoExpire; IF_NOT_OK_RETURN(rdbLoad(p, 8, RQ_ALLOC, NULL, &binfoExpire)); } @@ -2666,8 +2666,8 @@ RdbStatus rdbLoadString(RdbParser *p, AllocTypeRq type, char *refBuf, BulkInfo * return rdbLoadLzfString(p, type, refBuf, binfo); default: RDB_reportError(p, RDB_ERR_STRING_UNKNOWN_ENCODING_TYPE, - "rdbLoadString(): Unknown RDB string encoding type: %lu (0x%lx)", - len, len); + "rdbLoadString(): Unknown RDB string encoding type: %" + PRIu64 " (0x%" PRIx64 ")", len, len); return RDB_STATUS_ERROR; } } diff --git a/src/lib/parserRaw.c b/src/lib/parserRaw.c index 79b736c..0e9f9c6 100644 --- a/src/lib/parserRaw.c +++ b/src/lib/parserRaw.c @@ -6,14 +6,13 @@ * expects structured data, whereas LEVEL0 is a dump of raw data that its main purpose * is to use it along with RESTORE command to play it against live Redis server. */ - +#include #include #include #include "../../deps/redis/lzf.h" #include "bulkAlloc.h" #include "parser.h" #include "defines.h" -#include "../../deps/redis/endianconv.h" #include "../../deps/redis/util.h" #include "../../deps/redis/listpack.h" #include "../../deps/redis/ziplist.h" @@ -318,8 +317,8 @@ RdbStatus elementRawString(RdbParser *p) { break; default: RDB_reportError(p, RDB_ERR_STRING_UNKNOWN_ENCODING_TYPE, - "elementRawString(): Unknown RDB string encoding type: %lu (0x%lx)", - strCtx->len, strCtx->len); + "elementRawString(): Unknown RDB string encoding type: %" + PRIu64 " (0x%" PRIx64 ")", strCtx->len, strCtx->len); return RDB_STATUS_ERROR; } } @@ -423,8 +422,8 @@ RdbStatus elementRawString(RdbParser *p) { } RDB_reportError(p, RDB_ERR_STRING_UNKNOWN_ENCODING_TYPE, - "elementRawString(): Unknown RDB string encoding type: %lu (0x%lx)", - strCtx->encoding, strCtx->encoding); + "elementRawString(): Unknown RDB string encoding type: %" + PRIu64 " (0x%" PRIx64 ")", strCtx->encoding, strCtx->encoding); return RDB_STATUS_ERROR; } @@ -464,10 +463,9 @@ RdbStatus elementRawHash(RdbParser *p) { case ST_RAW_HASH_HEADER: offset = processedBytes = 0; - aggMakeRoom(p, 20); /* > optional 8 bytes + worse case 9 bytes for len */ + aggMakeRoom(p, 8 /*optional*/ + LONG_STR_SIZE); if (p->currOpcode == RDB_TYPE_HASH_METADATA) { - /* load min expiration time. Do nothing with it since each field - * goanna report anyway its expiration time */ + /* Load min expiration time */ IF_NOT_OK_RETURN(rdbLoad(p, 8, RQ_ALLOC_REF, rawCtx->at, &binfo)); offset = processedBytes = 8; }