From 232c4f4a486583509cc75657c8d9fe3a7b6445c6 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 23 Dec 2022 18:24:05 +0800 Subject: [PATCH] fix(util): tcompare.c modify over --- source/util/src/tbuffer.c | 1 + source/util/src/tcompare.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/util/src/tbuffer.c b/source/util/src/tbuffer.c index 5a7e89f7cd..2c270782a7 100644 --- a/source/util/src/tbuffer.c +++ b/source/util/src/tbuffer.c @@ -16,6 +16,7 @@ #define _DEFAULT_SOURCE #include "tbuffer.h" #include "texception.h" +#include "tlog.h" typedef union Un4B { uint32_t ui; diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index d84a3d25c6..3cc903a1ca 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -243,7 +243,7 @@ int32_t compareJsonVal(const void *pLeft, const void *pRight) { } else if (leftType == TSDB_DATA_TYPE_NULL) { return 0; } else { - assert(0); + ASSERTS(0, "data type unexpected"); return 0; } } @@ -1176,7 +1176,7 @@ int32_t taosArrayCompareString(const void *a, const void *b) { int32_t compareStrPatternMatch(const void *pLeft, const void *pRight) { SPatternCompareInfo pInfo = {'%', '_'}; - assert(varDataLen(pRight) <= TSDB_MAX_FIELD_LEN); + ASSERTS(varDataLen(pRight) <= TSDB_MAX_FIELD_LEN, "variant data len over TSDB_MAX_FIELD_LEN"); char *pattern = taosMemoryCalloc(varDataLen(pRight) + 1, sizeof(char)); memcpy(pattern, varDataVal(pRight), varDataLen(pRight)); @@ -1198,7 +1198,7 @@ int32_t compareStrPatternNotMatch(const void *pLeft, const void *pRight) { int32_t compareWStrPatternMatch(const void *pLeft, const void *pRight) { SPatternCompareInfo pInfo = {'%', '_'}; - assert(varDataLen(pRight) <= TSDB_MAX_FIELD_LEN * TSDB_NCHAR_SIZE); + ASSERTS(varDataLen(pRight) <= TSDB_MAX_FIELD_LEN * TSDB_NCHAR_SIZE, "variant data len over TSDB_MAX_FIELD_LEN * TSDB_NCHAR_SIZE"); char *pattern = taosMemoryCalloc(varDataLen(pRight) + TSDB_NCHAR_SIZE, 1); memcpy(pattern, varDataVal(pRight), varDataLen(pRight)); @@ -1235,7 +1235,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_TIMESTAMP: return setChkInBytes8; default: - assert(0); + ASSERTS(0, "data type unexpected"); } } @@ -1258,7 +1258,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_TIMESTAMP: return setChkNotInBytes8; default: - assert(0); + ASSERTS(0, "data type unexpected"); } } -- GitLab