From 8cdd7023c64cac2129bb07f4f9a8c5e0b59ffbaa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 21 Jan 2022 00:32:58 -0800 Subject: [PATCH] remove warnings --- source/common/src/ttime.c | 8 ++++---- source/libs/sync/src/raft_handle_vote_message.c | 2 +- source/libs/sync/src/sync.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 5c6b9ff6f3..f9755a43b9 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -100,12 +100,12 @@ int32_t taosParseTime(const char* timestr, int64_t* time, int32_t len, int32_t t } else if (checkTzPresent(timestr, len)) { return parseTimeWithTz(timestr, time, timePrec, 0); } else { - return (*parseLocaltimeFp[day_light])(timestr, time, timePrec); + return (*parseLocaltimeFp[day_light])((char*)timestr, time, timePrec); } } -bool checkTzPresent(const char *str, int32_t len) { - char *seg = forwardToTimeStringEnd(str); +bool checkTzPresent(const char* str, int32_t len) { + char* seg = forwardToTimeStringEnd((char*)str); int32_t seg_len = len - (int32_t)(seg - str); char *c = &seg[seg_len - 1]; @@ -267,7 +267,7 @@ int32_t parseTimeWithTz(const char* timestr, int64_t* time, int32_t timePrec, ch #endif int64_t fraction = 0; - str = forwardToTimeStringEnd(timestr); + str = forwardToTimeStringEnd((char*)timestr); if ((str[0] == 'Z' || str[0] == 'z') && str[1] == '\0') { /* utc time, no millisecond, return directly*/ diff --git a/source/libs/sync/src/raft_handle_vote_message.c b/source/libs/sync/src/raft_handle_vote_message.c index 0219e39df9..4d940732dc 100644 --- a/source/libs/sync/src/raft_handle_vote_message.c +++ b/source/libs/sync/src/raft_handle_vote_message.c @@ -37,7 +37,7 @@ int syncRaftHandleVoteMessage(SSyncRaft* pRaft, const SSyncMessage* pMsg) { if (pRespMsg == NULL) { return 0; } - syncInfo("[%d:%d] [logterm: %" PRId64 ", index: %" PRId64 ", vote: %d] %s for %d"\ + syncInfo("[%d:%d] [logterm: %" PRId64 ", index: %" PRId64 ", vote: %d] %s for %d" "[logterm: %" PRId64 ", index: %" PRId64 "] at term %" PRId64 "", pRaft->selfGroupId, pRaft->selfId, lastTerm, lastIndex, pRaft->voteFor, grant ? "grant" : "reject", diff --git a/source/libs/sync/src/sync.c b/source/libs/sync/src/sync.c index e49b1d7983..321b03d2ee 100644 --- a/source/libs/sync/src/sync.c +++ b/source/libs/sync/src/sync.c @@ -23,8 +23,8 @@ SSyncManager* gSyncManager = NULL; #define SYNC_ACTIVITY_TIMER 5 #define SYNC_SERVER_WORKER 2 -static void syncProcessRsp(SRpcMsg *pMsg, SEpSet *pEpSet); -static void syncProcessReqMsg(SRpcMsg *pMsg, SEpSet *pEpSet); +static void syncProcessRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); +static void syncProcessReqMsg(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet); static int syncInitRpcServer(SSyncManager* syncManager, const SSyncCluster* pSyncCfg); static int syncInitRpcClient(SSyncManager* syncManager); @@ -119,7 +119,7 @@ SSyncNode* syncStart(const SSyncInfo* pInfo) { return NULL; } - pNode->syncTimer = taosTmrStart(syncNodeTick, SYNC_TICK_TIMER, (void*)pInfo->vgId, gSyncManager->syncTimerManager); + pNode->syncTimer = taosTmrStart(syncNodeTick, SYNC_TICK_TIMER, (void*)((int64_t)pInfo->vgId), gSyncManager->syncTimerManager); // start raft pNode->raft.pNode = pNode; @@ -176,12 +176,12 @@ int32_t syncRemoveNode(SSyncNode syncNode, const SNodeInfo *pNode) { } // process rpc rsp message from other sync server -static void syncProcessRsp(SRpcMsg *pMsg, SEpSet *pEpSet) { +static void syncProcessRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { } // process rpc message from other sync server -static void syncProcessReqMsg(SRpcMsg *pMsg, SEpSet *pEpSet) { +static void syncProcessReqMsg(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { } @@ -195,7 +195,7 @@ static int syncInitRpcServer(SSyncManager* syncManager, const SSyncCluster* pSyn } assert(pSyncCfg->selfIndex < pSyncCfg->replica && pSyncCfg->selfIndex >= 0); const SNodeInfo* pNode = &(pSyncCfg->nodeInfo[pSyncCfg->replica]); - char buffer[20] = {'\0'}; + char buffer[156] = {'\0'}; snprintf(buffer, sizeof(buffer), "%s:%d", &(pNode->nodeFqdn[0]), pNode->nodePort); size_t len = strlen(buffer); void** ppRpcServer = taosHashGet(gSyncManager->rpcServerTable, buffer, len); @@ -287,7 +287,7 @@ static void *syncWorkerMain(void *argv) { } static void syncNodeTick(void *param, void *tmrId) { - SyncGroupId vgId = (SyncGroupId)param; + SyncGroupId vgId = (SyncGroupId)((int64_t)param); SSyncNode **ppNode = taosHashGet(gSyncManager->vgroupTable, &vgId, sizeof(SyncGroupId*)); if (ppNode == NULL) { return; @@ -298,5 +298,5 @@ static void syncNodeTick(void *param, void *tmrId) { syncRaftTick(&pNode->raft); pthread_mutex_unlock(&pNode->mutex); - pNode->syncTimer = taosTmrStart(syncNodeTick, SYNC_TICK_TIMER, (void*)pNode->vgId, gSyncManager->syncTimerManager); + pNode->syncTimer = taosTmrStart(syncNodeTick, SYNC_TICK_TIMER, (void*)(int64_t)pNode->vgId, gSyncManager->syncTimerManager); } \ No newline at end of file