diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index 33828d93f009207422ffe1083335e4091c9d98b8..f26a6d75d7444ad0143946f575b7a0f11af78fd9 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 3090b7e30bcc145c7f004f05db4be61059590edc..1000b96a31c91ca90e7c1267c060c8f728982d56 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; }