From 83eef6f53a6b81a4edde3200f482ff6ffee2add6 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 18 Sep 2021 10:25:29 +0800 Subject: [PATCH] TD-6129 fix json encode error --- src/client/src/tscUtil.c | 4 ++-- src/tsdb/src/tsdbMeta.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index ac45c89e71..3d47973f67 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -5203,7 +5203,7 @@ char* parseTagDatatoJson(void *p){ }else{ // json value char tagJsonValue[TSDB_MAX_TAGS_LEN] = {0}; if(*(char*)val == cJSON_String){ - int32_t length = taosUcs4ToMbs(varDataVal(val + CHAR_BYTES), varDataLen(val + CHAR_BYTES), tagJsonValue); + int32_t length = taosUcs4ToMbs(varDataVal(POINTER_SHIFT(val,CHAR_BYTES)), varDataLen(POINTER_SHIFT(val,CHAR_BYTES)), tagJsonValue); if (length == 0) { tscError("charset:%s to %s. val:%s convert json value failed.", DEFAULT_UNICODE_ENCODEC, tsCharset, (char*)val); goto end; @@ -5215,7 +5215,7 @@ char* parseTagDatatoJson(void *p){ } cJSON_AddItemToObject(json, tagJsonKey, value); }else if(*(char*)val == cJSON_Number){ - double jsonVd = *(double*)(val + CHAR_BYTES); + double jsonVd = *(double*)(POINTER_SHIFT(val,CHAR_BYTES)); cJSON* value = cJSON_CreateNumber(jsonVd); if (value == NULL) { diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 8646e68763..e1bc5f05d9 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -212,7 +212,7 @@ void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_ char *val = NULL; if (type == TSDB_DATA_TYPE_JSON){ - val = kvRowValues(((STable*)pTable)->tagVal); + val = ((STable*)pTable)->tagVal; }else{ val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId); } -- GitLab