提交 5f49e360 编写于 作者: H Hui Li

modify for coverity scan

上级 9a6dd6d4
......@@ -911,21 +911,27 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
(void)lseek(fd, 0, SEEK_SET);
STableRecord tableInfo;
//STableRecord tableInfo;
char tableName[TSDB_TABLE_NAME_LEN] ;
char metricName[TSDB_TABLE_NAME_LEN];
while (1) {
memset(&tableInfo, 0, sizeof(STableRecord));
ssize_t ret;
while (1) {
//memset(&tableInfo, 0, sizeof(STableRecord));
memset(tableName, 0, TSDB_TABLE_NAME_LEN);
memset(metricName, 0, TSDB_TABLE_NAME_LEN);
ssize_t ret = read(fd, &tableInfo, sizeof(STableRecord));
//ssize_t ret = read(fd, &tableInfo, sizeof(STableRecord));
//if (ret <= 0) break;
ret = read(fd, tableName, TSDB_TABLE_NAME_LEN);
if (ret <= 0) break;
ret = read(fd, metricName, TSDB_TABLE_NAME_LEN);
if (ret <= 0) break;
//tableInfo.name[sizeof(tableInfo.name) - 1] = 0;
//tableInfo.metric[sizeof(tableInfo.metric) - 1] = 0;
//taosDumpTable(tableInfo.name, tableInfo.metric, arguments, fp);
tstrncpy(tableName, tableInfo.name, TSDB_TABLE_NAME_LEN-1);
tstrncpy(metricName, tableInfo.metric, TSDB_TABLE_NAME_LEN-1);
//tstrncpy(tableName, tableInfo.name, TSDB_TABLE_NAME_LEN-1);
//tstrncpy(metricName, tableInfo.metric, TSDB_TABLE_NAME_LEN-1);
taosDumpTable(tableName, metricName, arguments, fp);
}
......
......@@ -468,7 +468,8 @@ void taosHashTableResize(SHashObj *pHashObj) {
return;
}
void *pNewEntry = realloc(pHashObj->hashList, POINTER_BYTES * newSize);
int32_t pointerSize = POINTER_BYTES;
void *pNewEntry = realloc(pHashObj->hashList, pointerSize * newSize);
if (pNewEntry == NULL) {// todo handle error
// uTrace("cache resize failed due to out of memory, capacity remain:%d", pHashObj->capacity);
return;
......
......@@ -56,8 +56,13 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0,
year -= 1;
}
int64_t res = (((((int64_t) (year/4 - year/100 + year/400 + (int64_t)(367*mon)/12 + day) +
year*365 - 719499)*24 + hour)*60 + min)*60 + sec);
//int64_t res = (((((int64_t) (year/4 - year/100 + year/400 + 367*mon/12 + day) +
// year*365 - 719499)*24 + hour)*60 + min)*60 + sec);
int64_t res;
res = 367*((int64_t)mon)/12;
res += year/4 - year/100 + year/400 + day + year*365 - 719499;
res = res*24;
res = ((res + hour) * 60 + min) * 60 + sec;
return (res + timezone);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册