From ad0dd88ba1d948e3e0af950acff11f36ecc085cf Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Wed, 12 Jun 2024 22:31:08 +0800 Subject: [PATCH] fix:[TD-30579]compile error in macOS 14.5 and m3 chip --- source/common/src/tvariant.c | 6 +++--- source/libs/function/src/tpercentile.c | 2 +- source/libs/function/src/tudf.c | 4 ++++ source/util/src/tunit.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/common/src/tvariant.c b/source/common/src/tvariant.c index ae2c8c0c14..06ba3a5a59 100644 --- a/source/common/src/tvariant.c +++ b/source/common/src/tvariant.c @@ -88,7 +88,7 @@ static int32_t parseSignAndUInteger(const char *z, int32_t n, bool *is_neg, uint if (errno == ERANGE || errno == EINVAL || endPtr - z != n) { return TSDB_CODE_FAILED; } - if (val > UINT64_MAX) { + if (val > (double)UINT64_MAX) { errno = ERANGE; return TSDB_CODE_FAILED; } @@ -172,7 +172,7 @@ int32_t toIntegerEx(const char *z, int32_t n, uint32_t type, int64_t *value) { } break; case TK_NK_FLOAT: { double val = round(taosStr2Double(z, &endPtr)); - if (!IS_VALID_INT64(val)) { + if(val >= (double)INT64_MIN && val <= (double)INT64_MAX){ return TSDB_CODE_FAILED; } if (errno == ERANGE || errno == EINVAL || endPtr - z != n) { @@ -271,7 +271,7 @@ int32_t toUIntegerEx(const char *z, int32_t n, uint32_t type, uint64_t *value) { } break; case TK_NK_FLOAT: { double val = round(taosStr2Double(p, &endPtr)); - if (!IS_VALID_UINT64(val)) { + if (val < 0 || val > (double)UINT64_MAX) { return TSDB_CODE_FAILED; } if (errno == ERANGE || errno == EINVAL || endPtr - z != n) { diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index c671e7717c..776a7fb95a 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -64,7 +64,7 @@ static SFilePage *loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx) static void resetBoundingBox(MinMaxEntry *range, int32_t type) { if (IS_SIGNED_NUMERIC_TYPE(type)) { range->dMaxVal = INT64_MIN; - range->dMinVal = INT64_MAX; + range->dMinVal = (double)INT64_MAX; } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { range->u64MaxVal = 0; range->u64MinVal = UINT64_MAX; diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 7e344866a5..5f7764f342 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -26,6 +26,10 @@ #include "tudf.h" #include "tudfInt.h" +#ifdef _TD_DARWIN_64 +#include +#endif + typedef struct SUdfdData { bool startCalled; bool needCleanUp; diff --git a/source/util/src/tunit.c b/source/util/src/tunit.c index 09f59f1e40..4ec9e39fde 100644 --- a/source/util/src/tunit.c +++ b/source/util/src/tunit.c @@ -24,7 +24,7 @@ #define UNIT_ONE_EXBIBYTE (UNIT_ONE_PEBIBYTE * UNIT_SIZE_CONVERT_FACTOR) static int32_t parseCfgIntWithUnit(const char* str, double *res) { - double val, temp = INT64_MAX; + double val, temp = (double)INT64_MAX; char* endPtr; errno = 0; val = taosStr2Int64(str, &endPtr, 0);