提交 4ee6c822 编写于 作者: S stephenkgu

use size_t instead of int32_t to avoid possible loss of data

上级 1c33675b
...@@ -25,7 +25,7 @@ void extractTableName(const char *tableId, char *name); ...@@ -25,7 +25,7 @@ void extractTableName(const char *tableId, char *name);
char* extractDBName(const char *tableId, char *name); char* extractDBName(const char *tableId, char *name);
int32_t tableIdPrefix(const char* pDb, char* prefix, int32_t len); size_t tableIdPrefix(const char* pDb, char* prefix, int32_t len);
void extractTableNameFromToken(SStrToken *pToken, SStrToken* pTable); void extractTableNameFromToken(SStrToken *pToken, SStrToken* pTable);
......
...@@ -39,7 +39,7 @@ char* extractDBName(const char* tableId, char* name) { ...@@ -39,7 +39,7 @@ char* extractDBName(const char* tableId, char* name) {
return strncpy(name, &tableId[offset1 + 1], len); return strncpy(name, &tableId[offset1 + 1], len);
} }
int32_t tableIdPrefix(const char* name, char* prefix, int32_t len) { size_t tableIdPrefix(const char* name, char* prefix, int32_t len) {
tstrncpy(prefix, name, len); tstrncpy(prefix, name, len);
strcat(prefix, TS_PATH_DELIMITER); strcat(prefix, TS_PATH_DELIMITER);
......
...@@ -1736,7 +1736,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { ...@@ -1736,7 +1736,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
STagData *pTagData = (STagData *)pCreate->schema; // it is a tag key STagData *pTagData = (STagData *)pCreate->schema; // it is a tag key
char prefix[64] = {0}; char prefix[64] = {0};
int32_t prefixLen = tableIdPrefix(pMsg->pDb->name, prefix, 64); size_t prefixLen = tableIdPrefix(pMsg->pDb->name, prefix, 64);
if (0 != strncasecmp(prefix, pTagData->name, prefixLen)) { if (0 != strncasecmp(prefix, pTagData->name, prefixLen)) {
mError("msg:%p, app:%p table:%s, corresponding super table:%s not in this db", pMsg, pMsg->rpcMsg.ahandle, mError("msg:%p, app:%p table:%s, corresponding super table:%s not in this db", pMsg, pMsg->rpcMsg.ahandle,
pCreate->tableId, pTagData->name); pCreate->tableId, pTagData->name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册