From 87b63a9fbe5dbb111d7a763b57af34adc5021504 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 28 Feb 2022 14:36:50 +0800 Subject: [PATCH] minor changes --- include/util/taoserror.h | 2 -- include/util/tversion.h | 2 ++ source/util/src/talgo.c | 10 +++++----- source/util/src/tversion.c | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 2663084103..2b569a491a 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -20,8 +20,6 @@ extern "C" { #endif -// clang-format off - #define TAOS_DEF_ERROR_CODE(mod, code) ((int32_t)((0x80000000 | ((mod)<<16) | (code)))) #define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code)) diff --git a/include/util/tversion.h b/include/util/tversion.h index 1774059cf1..c924752a01 100644 --- a/include/util/tversion.h +++ b/include/util/tversion.h @@ -16,6 +16,8 @@ #ifndef _TD_UTIL_VERSION_H_ #define _TD_UTIL_VERSION_H_ +#include "os.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/util/src/talgo.c b/source/util/src/talgo.c index 6c5f2a05be..cb0a2d25a9 100644 --- a/source/util/src/talgo.c +++ b/source/util/src/talgo.c @@ -158,12 +158,12 @@ void taosqsort(void *src, int64_t numOfElem, int64_t size, const void *param, __ tfree(buf); } -void *taosbsearch(const void *key, const void *base, int64_t nmemb, int64_t size, __compar_fn_t compar, int flags) { +void *taosbsearch(const void *key, const void *base, int64_t nmemb, int64_t size, __compar_fn_t compar, int32_t flags) { // TODO: need to check the correctness of this function - int l = 0; - int r = (int)nmemb; - int idx = 0; - int comparison; + int32_t l = 0; + int32_t r = (int32_t)nmemb; + int32_t idx = 0; + int32_t comparison; if (flags == TD_EQ) { return bsearch(key, base, nmemb, size, compar); diff --git a/source/util/src/tversion.c b/source/util/src/tversion.c index 8409637e80..c70fdc87a6 100644 --- a/source/util/src/tversion.c +++ b/source/util/src/tversion.c @@ -14,9 +14,8 @@ */ #define _DEFAULT_SOURCE -#include "os.h" +#include "tversion.h" #include "taoserror.h" -#include "tdef.h" int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) { if (vstr == NULL) { -- GitLab