From 020a16491538e004a4dd62dd156005de0885b486 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 15 May 2023 11:54:25 +0200 Subject: [PATCH] MT#57432 field precision specifier '.*' expects argument of type 'int' We have to manually cast the `->len` of type `size_t` to the `int` type, when it's used for the printing of logs. Change-Id: I7e116425aecf5ee7e39d8df868edc05b33581014 --- apps/dsm/mods/mod_redis/DRedisConnection.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/dsm/mods/mod_redis/DRedisConnection.cpp b/apps/dsm/mods/mod_redis/DRedisConnection.cpp index 654ae6c1..b16c7696 100644 --- a/apps/dsm/mods/mod_redis/DRedisConnection.cpp +++ b/apps/dsm/mods/mod_redis/DRedisConnection.cpp @@ -89,7 +89,7 @@ int DRedisConnection::handle_redis_reply(redisReply *reply, const char* _cmd) { case REDIS_REPLY_STRING: if (reply->len>=0) { if (cfg.full_logging) { - DBG("REDIS %s: str: %.*s\n", _cmd, reply->len, reply->str); + DBG("REDIS %s: str: %.*s\n", _cmd, (int) reply->len, reply->str); } } break; @@ -104,9 +104,7 @@ int DRedisConnection::handle_redis_reply(redisReply *reply, const char* _cmd) { }; for (size_t i=0;ielements;i++) { switch(reply->element[i]->type) { - case REDIS_REPLY_ERROR: ERROR("REDIS %s ERROR: %.*s\n", - _cmd, reply->element[i]->len, - reply->element[i]->str); + case REDIS_REPLY_ERROR: ERROR("REDIS %s ERROR: %.*s\n", _cmd, (int) reply->element[i]->len, reply->element[i]->str); return DB_E_WRITE; case REDIS_REPLY_INTEGER: @@ -127,10 +125,9 @@ int DRedisConnection::handle_redis_reply(redisReply *reply, const char* _cmd) { case REDIS_REPLY_STATUS: case REDIS_REPLY_STRING: if (cfg.full_logging) { - if (reply->element[i]->len >= 0) { - DBG("REDIS %s: %.*s\n", _cmd, - reply->element[i]->len, reply->element[i]->str); - } + if (reply->element[i]->len >= 0) { + DBG("REDIS %s: %.*s\n", _cmd, (int) reply->element[i]->len, reply->element[i]->str); + } } break; default: