Merge pull request #20139 from taosdata/fix/TD-22664-3.0
fix: fix coverity issue
This commit is contained in:
commit
cb2f09ed6c
|
@ -53,10 +53,6 @@ typedef struct {
|
||||||
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
|
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
|
||||||
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
|
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
|
||||||
|
|
||||||
// this data type is internally used only in 'in' query to hold the values
|
|
||||||
#define TSDB_DATA_TYPE_POINTER_ARRAY (1000)
|
|
||||||
#define TSDB_DATA_TYPE_VALUE_ARRAY (1001)
|
|
||||||
|
|
||||||
#define GET_TYPED_DATA(_v, _finalType, _type, _data) \
|
#define GET_TYPED_DATA(_v, _finalType, _type, _data) \
|
||||||
do { \
|
do { \
|
||||||
switch (_type) { \
|
switch (_type) { \
|
||||||
|
|
|
@ -145,19 +145,6 @@ void taosVariantDestroy(SVariant *pVar) {
|
||||||
pVar->nLen = 0;
|
pVar->nLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: this is only for string array
|
|
||||||
if (pVar->nType == TSDB_DATA_TYPE_POINTER_ARRAY) {
|
|
||||||
size_t num = taosArrayGetSize(pVar->arr);
|
|
||||||
for (size_t i = 0; i < num; i++) {
|
|
||||||
void *p = taosArrayGetP(pVar->arr, i);
|
|
||||||
taosMemoryFree(p);
|
|
||||||
}
|
|
||||||
taosArrayDestroy(pVar->arr);
|
|
||||||
pVar->arr = NULL;
|
|
||||||
} else if (pVar->nType == TSDB_DATA_TYPE_VALUE_ARRAY) {
|
|
||||||
taosArrayDestroy(pVar->arr);
|
|
||||||
pVar->arr = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) {
|
void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) {
|
||||||
|
@ -180,28 +167,8 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) {
|
||||||
|
|
||||||
if (IS_NUMERIC_TYPE(pSrc->nType) || (pSrc->nType == TSDB_DATA_TYPE_BOOL)) {
|
if (IS_NUMERIC_TYPE(pSrc->nType) || (pSrc->nType == TSDB_DATA_TYPE_BOOL)) {
|
||||||
pDst->i = pSrc->i;
|
pDst->i = pSrc->i;
|
||||||
} else if (pSrc->nType == TSDB_DATA_TYPE_POINTER_ARRAY) { // this is only for string array
|
|
||||||
size_t num = taosArrayGetSize(pSrc->arr);
|
|
||||||
pDst->arr = taosArrayInit(num, sizeof(char *));
|
|
||||||
for (size_t i = 0; i < num; i++) {
|
|
||||||
char *p = (char *)taosArrayGetP(pSrc->arr, i);
|
|
||||||
char *n = taosStrdup(p);
|
|
||||||
taosArrayPush(pDst->arr, &n);
|
|
||||||
}
|
|
||||||
} else if (pSrc->nType == TSDB_DATA_TYPE_VALUE_ARRAY) {
|
|
||||||
size_t num = taosArrayGetSize(pSrc->arr);
|
|
||||||
pDst->arr = taosArrayInit(num, sizeof(int64_t));
|
|
||||||
pDst->nLen = pSrc->nLen;
|
|
||||||
ASSERT(pSrc->nLen == num);
|
|
||||||
for (size_t i = 0; i < num; i++) {
|
|
||||||
int64_t *p = taosArrayGet(pSrc->arr, i);
|
|
||||||
taosArrayPush(pDst->arr, p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDst->nType != TSDB_DATA_TYPE_POINTER_ARRAY && pDst->nType != TSDB_DATA_TYPE_VALUE_ARRAY) {
|
|
||||||
pDst->nLen = tDataTypes[pDst->nType].bytes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2) {
|
int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2) {
|
||||||
|
|
|
@ -1651,12 +1651,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options)
|
||||||
|
|
||||||
SValueNode *var = (SValueNode *)field->desc;
|
SValueNode *var = (SValueNode *)field->desc;
|
||||||
SDataType *dType = &var->node.resType;
|
SDataType *dType = &var->node.resType;
|
||||||
// if (dType->type == TSDB_DATA_TYPE_VALUE_ARRAY) {
|
|
||||||
// qDebug("VAL%d => [type:TS][val:[%" PRIi64 "] - [%" PRId64 "]]", i, *(int64_t *)field->data,
|
|
||||||
// *(((int64_t *)field->data) + 1));
|
|
||||||
// } else {
|
|
||||||
qDebug("VAL%d => [type:%d][val:%" PRIx64 "]", i, dType->type, var->datum.i); // TODO
|
qDebug("VAL%d => [type:%d][val:%" PRIx64 "]", i, dType->type, var->datum.i); // TODO
|
||||||
//}
|
|
||||||
} else if (field->data) {
|
} else if (field->data) {
|
||||||
qDebug("VAL%d => [type:NIL][val:NIL]", i); // TODO
|
qDebug("VAL%d => [type:NIL][val:NIL]", i); // TODO
|
||||||
}
|
}
|
||||||
|
@ -1976,18 +1971,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
|
||||||
|
|
||||||
fi->data = taosMemoryCalloc(1, bytes);
|
fi->data = taosMemoryCalloc(1, bytes);
|
||||||
} else {
|
} else {
|
||||||
if (dType->type == TSDB_DATA_TYPE_VALUE_ARRAY) { // TIME RANGE
|
fi->data = taosMemoryCalloc(1, sizeof(int64_t));
|
||||||
/*
|
|
||||||
fi->data = taosMemoryCalloc(dType->bytes, tDataTypes[type].bytes);
|
|
||||||
for (int32_t a = 0; a < dType->bytes; ++a) {
|
|
||||||
int64_t *v = taosArrayGet(var->arr, a);
|
|
||||||
assignVal((char *)fi->data + a * tDataTypes[type].bytes, (char *)v, 0, type);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
fi->data = taosMemoryCalloc(1, sizeof(int64_t));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dType->type == type) {
|
if (dType->type == type) {
|
||||||
|
|
Loading…
Reference in New Issue