From 5ef542368eefa8ec6b167e47761ad30d389656e5 Mon Sep 17 00:00:00 2001 From: slguan Date: Mon, 9 Dec 2019 11:43:25 +0800 Subject: [PATCH] [TBASE-1299] --- src/client/src/tscFunctionImpl.c | 2 -- src/client/src/tscParseInsert.c | 3 --- src/client/src/tscSQLParser.c | 2 -- src/system/detail/inc/mgmt.h | 2 +- src/system/detail/src/mgmtShell.c | 2 -- src/system/lite/src/dnodeMgmt.spec.c | 4 ++-- src/system/lite/src/mgmtBalance.spec.c | 2 +- src/system/lite/src/mgmtDnodeInt.spec.c | 4 ++-- src/system/lite/src/vnodeFile.spec.c | 2 +- src/util/src/tcompression.c | 16 ++++++++-------- src/util/src/tcrc32c.c | 2 -- src/util/src/textbuffer.c | 2 -- src/util/src/ttokenizer.c | 8 ++++---- 13 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c index 2d913b2f20..de7716db4d 100644 --- a/src/client/src/tscFunctionImpl.c +++ b/src/client/src/tscFunctionImpl.c @@ -13,8 +13,6 @@ * along with this program. If not, see . */ -#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" - #include "os.h" #include "taosmsg.h" #include "tast.h" diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 6317decbe0..bf2b88c995 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -18,9 +18,6 @@ #define _XOPEN_SOURCE -#pragma GCC diagnostic ignored "-Woverflow" -#pragma GCC diagnostic ignored "-Wunused-variable" - #include "os.h" #include "ihash.h" #include "tscSecondaryMerge.h" diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 752c5d123f..1bd710f2fb 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -28,8 +28,6 @@ #include "tsclient.h" #include "tscSQLParser.h" -#pragma GCC diagnostic ignored "-Wunused-variable" - #define DEFAULT_PRIMARY_TIMESTAMP_COL_NAME "_c0" // -1 is tbname column index, so here use the -2 as the initial value diff --git a/src/system/detail/inc/mgmt.h b/src/system/detail/inc/mgmt.h index 75ec841076..c75422e23e 100644 --- a/src/system/detail/inc/mgmt.h +++ b/src/system/detail/inc/mgmt.h @@ -419,7 +419,7 @@ void mgmtCleanupBalance(); int mgmtAllocVnodes(SVgObj *pVgroup); void mgmtSetDnodeShellRemoving(SDnodeObj *pDnode); void mgmtSetDnodeUnRemove(SDnodeObj *pDnode); -void mgmtStartBalanceTimer(int mseconds); +void mgmtStartBalanceTimer(int64_t mseconds); void mgmtSetDnodeOfflineOnSdbChanged(); void mgmtUpdateVgroupState(SVgObj *pVgroup, int lbStatus, int srcIp); bool mgmtAddVnode(SVgObj *pVgroup, SDnodeObj *pSrcDnode, SDnodeObj *pDestDnode); diff --git a/src/system/detail/src/mgmtShell.c b/src/system/detail/src/mgmtShell.c index d00f4eaf06..f6b2d7ba9b 100644 --- a/src/system/detail/src/mgmtShell.c +++ b/src/system/detail/src/mgmtShell.c @@ -1363,5 +1363,3 @@ void mgmtInitProcessShellMsg() { mgmtProcessShellMsg[TSDB_MSG_TYPE_KILL_STREAM] = mgmtProcessKillStreamMsg; mgmtProcessShellMsg[TSDB_MSG_TYPE_KILL_CONNECTION] = mgmtProcessKillConnectionMsg; } - -#pragma GCC diagnostic pop diff --git a/src/system/lite/src/dnodeMgmt.spec.c b/src/system/lite/src/dnodeMgmt.spec.c index e40b21ab83..576dbcb337 100644 --- a/src/system/lite/src/dnodeMgmt.spec.c +++ b/src/system/lite/src/dnodeMgmt.spec.c @@ -50,7 +50,7 @@ char *taosBuildReqMsgToMnode(SMgmtObj *pObj, char type) { } int taosSendMsgToMnode(SMgmtObj *pObj, char *msg, int msgLen) { - dTrace("msg:%s is sent to mnode", taosMsg[*(msg-1)]); + dTrace("msg:%s is sent to mnode", taosMsg[(uint8_t)(*(msg-1))]); /* * Lite version has no message header, so minus one @@ -81,7 +81,7 @@ void vnodeProcessMsgFromMgmtSpec(SSchedMsg *sched) { char msgType = *sched->msg; char *content = sched->msg + 1; - dTrace("msg:%s is received from mgmt", taosMsg[msgType]); + dTrace("msg:%s is received from mgmt", taosMsg[(uint8_t)msgType]); vnodeProcessMsgFromMgmt(content, 0, msgType, 0); diff --git a/src/system/lite/src/mgmtBalance.spec.c b/src/system/lite/src/mgmtBalance.spec.c index 3d2f10dcbb..109f36af18 100644 --- a/src/system/lite/src/mgmtBalance.spec.c +++ b/src/system/lite/src/mgmtBalance.spec.c @@ -17,7 +17,7 @@ #include "mgmtBalance.h" #include "tstatus.h" -void mgmtStartBalanceTimer(int mseconds) {} +void mgmtStartBalanceTimer(int64_t mseconds) {} int mgmtInitBalance() { return 0; } diff --git a/src/system/lite/src/mgmtDnodeInt.spec.c b/src/system/lite/src/mgmtDnodeInt.spec.c index b99815844d..a914d630c2 100644 --- a/src/system/lite/src/mgmtDnodeInt.spec.c +++ b/src/system/lite/src/mgmtDnodeInt.spec.c @@ -61,7 +61,7 @@ char *taosBuildReqMsgToDnode(SDnodeObj *pObj, char type) { int taosSendSimpleRspToDnode(SDnodeObj *pObj, char rsptype, char code) { return 0; } int taosSendMsgToDnode(SDnodeObj *pObj, char *msg, int msgLen) { - mTrace("msg:%s is sent to dnode", taosMsg[*(msg-1)]); + mTrace("msg:%s is sent to dnode", taosMsg[(uint8_t)(*(msg-1))]); /* * Lite version has no message header, so minus one @@ -142,7 +142,7 @@ void mgmtProcessDnodeStatus(void *handle, void *tmrId) { void mgmtProcessMsgFromDnodeSpec(SSchedMsg *sched) { char msgType = *sched->msg; char *content = sched->msg + 1; - mTrace("msg:%s is received from dnode", taosMsg[msgType]); + mTrace("msg:%s is received from dnode", taosMsg[(uint8_t)msgType]); mgmtProcessMsgFromDnode(content, 0, msgType, mgmtGetDnode(0)); free(sched->msg); diff --git a/src/system/lite/src/vnodeFile.spec.c b/src/system/lite/src/vnodeFile.spec.c index 7b26ed6c9f..4ad624d2ad 100644 --- a/src/system/lite/src/vnodeFile.spec.c +++ b/src/system/lite/src/vnodeFile.spec.c @@ -24,7 +24,7 @@ char* vnodeGetDataDir(int vnode, int fileId) { return dataDir; } void vnodeAdustVnodeFile(SVnodeObj *pVnode) { // Retention policy here int fileId = pVnode->fileId - pVnode->numOfFiles + 1; - int cfile = taosGetTimestamp(pVnode->cfg.precision)/pVnode->cfg.daysPerFile/tsMsPerDay[pVnode->cfg.precision]; + int cfile = taosGetTimestamp(pVnode->cfg.precision)/pVnode->cfg.daysPerFile/tsMsPerDay[(uint8_t)pVnode->cfg.precision]; while (fileId <= cfile - pVnode->maxFiles) { vnodeRemoveFile(pVnode->vnode, fileId); pVnode->numOfFiles--; diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index 1ac42377fb..2425bc4d24 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -355,16 +355,16 @@ int tsCompressINTImp(const char *const input, const int nelements, char *const o tmp_bit = (LONG_BYTES * BITS_PER_BYTE) - BUILDIN_CLZL(zigzag_value); } - if (elems + 1 <= selector_to_elems[selector] && elems + 1 <= selector_to_elems[bit_to_selector[tmp_bit]]) { + if (elems + 1 <= selector_to_elems[(uint8_t)selector] && elems + 1 <= selector_to_elems[(uint8_t)bit_to_selector[(uint8_t)tmp_bit]]) { // If can hold another one. - selector = selector > bit_to_selector[tmp_bit] ? selector : bit_to_selector[tmp_bit]; + selector = selector > bit_to_selector[(uint8_t)tmp_bit] ? selector : bit_to_selector[(uint8_t)tmp_bit]; elems++; - bit = bit_per_integer[selector]; + bit = bit_per_integer[(uint8_t)selector]; } else { // if cannot hold another one. - while (elems < selector_to_elems[selector]) selector++; - elems = selector_to_elems[selector]; - bit = bit_per_integer[selector]; + while (elems < selector_to_elems[(uint8_t)selector]) selector++; + elems = selector_to_elems[(uint8_t)selector]; + bit = bit_per_integer[(uint8_t)selector]; break; } prev_value_tmp = curr_value; @@ -455,8 +455,8 @@ int tsDecompressINTImp(const char *const input, const int nelements, char *const memcpy(&w, ip, LONG_BYTES); char selector = (char)(w & INT64MASK(4)); // selector = 4 - char bit = bit_per_integer[selector]; // bit = 3 - int elems = selector_to_elems[selector]; + char bit = bit_per_integer[(uint8_t)selector]; // bit = 3 + int elems = selector_to_elems[(uint8_t)selector]; for (int i = 0; i < elems; i++) { uint64_t zigzag_value; diff --git a/src/util/src/tcrc32c.c b/src/util/src/tcrc32c.c index c67773f1ca..546693c4bb 100644 --- a/src/util/src/tcrc32c.c +++ b/src/util/src/tcrc32c.c @@ -25,8 +25,6 @@ #include #include "tcrc32c.h" -//todo : use the original source code -//#pragma GCC diagnostic ignored "-Wunused-function" #define POLY 0x82f63b78 #define LONG_SHIFT 8192 diff --git a/src/util/src/textbuffer.c b/src/util/src/textbuffer.c index 42c2cc1ed0..984164bfd2 100644 --- a/src/util/src/textbuffer.c +++ b/src/util/src/textbuffer.c @@ -23,8 +23,6 @@ #include "ttypes.h" #include "tutil.h" -//#pragma GCC diagnostic ignored "-Wformat" - #define COLMODEL_GET_VAL(data, schema, allrow, rowId, colId) \ (data + (schema)->colOffset[colId] * (allrow) + (rowId) * (schema)->pFields[colId].bytes) diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index f402963049..d23b0ab27c 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -510,7 +510,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) { if ((z[i] == 'a' || z[i] == 's' || z[i] == 'm' || z[i] == 'h' || z[i] == 'd' || z[i] == 'n' || z[i] == 'y' || z[i] == 'w' || z[i] == 'A' || z[i] == 'S' || z[i] == 'M' || z[i] == 'H' || z[i] == 'D' || z[i] == 'N' || z[i] == 'Y' || z[i] == 'W') && - (isIdChar[z[i + 1]] == 0)) { + (isIdChar[(uint8_t)z[i + 1]] == 0)) { *tokenType = TK_VARIABLE; i += 1; return i; @@ -551,7 +551,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) { case 't': case 'F': case 'f': { - for (i = 1; ((z[i] & 0x80) == 0) && isIdChar[z[i]]; i++) { + for (i = 1; ((z[i] & 0x80) == 0) && isIdChar[(uint8_t)z[i]]; i++) { } if ((i == 4 && strncasecmp(z, "true", 4) == 0) || (i == 5 && strncasecmp(z, "false", 5) == 0)) { @@ -560,10 +560,10 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) { } } default: { - if (((*z & 0x80) != 0) || !isIdChar[*z]) { + if (((*z & 0x80) != 0) || !isIdChar[(uint8_t)(*z)]) { break; } - for (i = 1; ((z[i] & 0x80) == 0) && isIdChar[z[i]]; i++) { + for (i = 1; ((z[i] & 0x80) == 0) && isIdChar[(uint8_t)z[i]]; i++) { } *tokenType = tSQLKeywordCode(z, i); return i; -- GitLab