From da40c92522b71157471254df524ddc4cd204c62a Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sat, 11 Apr 2020 10:45:11 +0800 Subject: [PATCH] [td-98] fix compiler error --- src/query/src/queryExecutor.c | 2 +- src/util/inc/tutil.h | 8 +------- src/util/src/tglobalcfg.c | 21 +++++++++++---------- src/util/src/tutil.c | 7 +++---- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/query/src/queryExecutor.c b/src/query/src/queryExecutor.c index e7b1399424..9cb2dcd6c6 100644 --- a/src/query/src/queryExecutor.c +++ b/src/query/src/queryExecutor.c @@ -924,7 +924,7 @@ static void blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStati STimeWindow win = getActiveTimeWindow(pWindowResInfo, ts, pQuery); if (setWindowOutputBufByKey(pRuntimeEnv, pWindowResInfo, pDataBlockInfo->sid, &win) != TSDB_CODE_SUCCESS) { - return 0; + return; } TSKEY ekey = reviseWindowEkey(pQuery, &win); diff --git a/src/util/inc/tutil.h b/src/util/inc/tutil.h index b7877b4307..c4c802a688 100644 --- a/src/util/inc/tutil.h +++ b/src/util/inc/tutil.h @@ -121,11 +121,7 @@ int64_t strnatoi(char *num, int32_t len); char* strreplace(const char* str, const char* pattern, const char* rep); -#define POW2(x) ((x) * (x)) - -int32_t strdequote(char *src); - -char *paGetToken(char *src, size_t maxLen, char **token, int32_t *tokenLen); +char *paGetToken(char *src, char **token, int32_t *tokenLen); void taosMsleep(int32_t mseconds); @@ -133,8 +129,6 @@ int32_t taosByteArrayToHexStr(char bytes[], int32_t len, char hexstr[]); int32_t taosHexStrToByteArray(char hexstr[], char bytes[]); -int64_t str2int64(char *str); - int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstPath); /** diff --git a/src/util/src/tglobalcfg.c b/src/util/src/tglobalcfg.c index a4c034c48d..8ce4530dbf 100644 --- a/src/util/src/tglobalcfg.c +++ b/src/util/src/tglobalcfg.c @@ -874,12 +874,13 @@ void tsReadGlobalLogConfig() { olen = vlen = 0; getline(&line, &len, fp); - - paGetToken(line, len, &option, &olen); + line[len - 1] = 0; + + paGetToken(line, &option, &olen); if (olen == 0) continue; option[olen] = 0; - paGetToken(option + olen + 1, len, &value, &vlen); + paGetToken(option + olen + 1, &value, &vlen); if (vlen == 0) continue; value[vlen] = 0; @@ -911,18 +912,19 @@ bool tsReadGlobalConfig() { olen = vlen = 0; getline(&line, &len, fp); - - paGetToken(line, len, &option, &olen); + line[len - 1] = 0; + + paGetToken(line, &option, &olen); if (olen == 0) continue; option[olen] = 0; - paGetToken(option + olen + 1, len, &value, &vlen); + paGetToken(option + olen + 1, &value, &vlen); if (vlen == 0) continue; value[vlen] = 0; // For dataDir, the format is: // dataDir /mnt/disk1 0 - paGetToken(value + vlen + 1, len, &value1, &vlen1); + paGetToken(value + vlen + 1, &value1, &vlen1); tsReadConfigOption(option, value); } @@ -1005,11 +1007,10 @@ int tsCfgDynamicOptions(char *msg) { int olen, vlen, code = 0; int vint = 0; - size_t len = 120; - paGetToken(msg, len, &option, &olen); + paGetToken(msg, &option, &olen); if (olen == 0) return TSDB_CODE_INVALID_MSG_CONTENT; - paGetToken(option + olen + 1, len, &value, &vlen); + paGetToken(option + olen + 1, &value, &vlen); if (vlen == 0) vint = 135; else { diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index ba06d73352..5f4c903279 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -164,9 +164,8 @@ char* strtolower(char *dst, const char *src) { return dst; } -char *paGetToken(char *string, size_t maxLen, char **token, int32_t *tokenLen) { +char *paGetToken(char *string, char **token, int32_t *tokenLen) { char quote = 0; - char* start = string; while (*string != 0) { if (*string == ' ' || *string == '\t') { @@ -183,7 +182,7 @@ char *paGetToken(char *string, size_t maxLen, char **token, int32_t *tokenLen) { *token = string; - while (*string != 0 && *string != '\n' && (string - start < maxLen)) { + while (*string != 0) { if (*string == '@' && quote) { //*string = 0; ++string; @@ -337,7 +336,7 @@ int32_t taosByteArrayToHexStr(char bytes[], int32_t len, char hexstr[]) { char hexval[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; for (i = 0; i < len; i++) { - hexstr[i * 2] = hexval[((bytes[i] >> 4) & 0xF)]; + hexstr[i * 2] = hexval[((bytes[i] >> 4u) & 0xF)]; hexstr[(i * 2) + 1] = hexval[(bytes[i]) & 0x0F]; } -- GitLab