fix(all): coverity scan problem fixed

This commit is contained in:
Alex Duan 2022-10-24 18:41:39 +08:00
parent d23b829c5b
commit 97e70e8f27
5 changed files with 6 additions and 9 deletions

View File

@ -191,7 +191,7 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
printf("failed to rename file %s to %s, reason:%s\n", oldName, newName, strerror(errno));
}
return code ? 0 : 1;
return code ? 0 : -1;
#else
int32_t code = rename(oldName, newName);
if (code < 0) {

View File

@ -2275,6 +2275,7 @@ int32_t tsCompressBool(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t
} else if (cmprAlg == TWO_STAGE_COMP) {
int32_t len = tsCompressBoolImp(pIn, nEle, pBuf);
if (len < 0) {
strerror(errno));
return -1;
}
return tsCompressStringImp(pBuf, len, pOut, nOut);

View File

@ -109,9 +109,7 @@ void tEndEncode(SEncoder* pCoder) {
pCoder->size = pNode->size;
pCoder->pos = pNode->pos;
if (tEncodeI32(pCoder, len) < 0) {
return;
}
(void)tEncodeI32(pCoder, len);
TD_CODER_MOVE_POS(pCoder, len);
}

View File

@ -207,9 +207,7 @@ static void taosKeepOldLog(char *oldName) {
char fileName[LOG_FILE_NAME_LEN + 20];
snprintf(fileName, LOG_FILE_NAME_LEN + 20, "%s.%" PRId64, tsLogObj.logName, fileSec);
if (taosRenameFile(oldName, fileName) != 0) {
return;
}
(void)taosRenameFile(oldName, fileName);
if (tsLogKeepDays < 0) {
char compressFileName[LOG_FILE_NAME_LEN + 20];

View File

@ -356,9 +356,9 @@ void enumFromTree(STire* tire, SMatch* match) {
}
// this branch have data
if (c->end)
if (c->end) {
addWordToMatch(match, pre);
else {
} else {
matchPrefix(tire, pre, match);
}
}