From 6c777907c0f33f38f9b6140b8bb77d114dd75074 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 4 Aug 2020 13:10:58 +0800 Subject: [PATCH] more --- src/util/src/tcompression.c | 7 ++----- src/util/src/tkvstore.c | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index 33828d93f0..f26a6d75d7 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -52,14 +52,11 @@ #include "tscompression.h" #include "taosdef.h" -const int TEST_NUMBER = 1; +static const int TEST_NUMBER = 1; #define is_bigendian() ((*(char *)&TEST_NUMBER) == 0) #define SIMPLE8B_MAX_INT64 ((uint64_t)2305843009213693951L) -bool safeInt64Add(int64_t a, int64_t b) { - if ((a > 0 && b > INT64_MAX - a) || (a < 0 && b < INT64_MIN - a)) return false; - return true; -} +#define safeInt64Add(a, b) (((a >= 0) && (b <= INT64_MAX - a)) || ((a < 0) && (b >= INT64_MIN - a))) /* * Compress Integer (Simple8B). diff --git a/src/util/src/tkvstore.c b/src/util/src/tkvstore.c index 3090b7e30b..1000b96a31 100644 --- a/src/util/src/tkvstore.c +++ b/src/util/src/tkvstore.c @@ -535,7 +535,7 @@ static int tdRestoreKVStore(SKVStore *pStore) { buf = malloc(maxBufSize); if (buf == NULL) { - uError("failed to allocate %d bytes in KV store %s", maxBufSize, pStore->fname); + uError("failed to allocate %" PRId64 " bytes in KV store %s", maxBufSize, pStore->fname); terrno = TAOS_SYSTEM_ERROR(errno); goto _err; } -- GitLab