From acf1b14b21e1612097b4f3fd294f9cc7842ed218 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 16 May 2022 01:47:35 +0000 Subject: [PATCH] fix compile problem --- include/common/tdataformat.h | 16 ++++++++-------- source/common/src/tdataformat.c | 19 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index ab0415d5d8..1a31b384d8 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -94,11 +94,11 @@ struct STSchema { #define TSROW_HAS_VAL ((uint8_t)0x4U) #define TSROW_KV_ROW ((uint8_t)0x10U) struct STSRow2 { - TSKEY ts; - uint8_t flags; - int32_t sver; - uint32_t nData; - uint8_t *pData; + TSKEY ts; + uint8_t flags; + int32_t sver; + uint32_t nData; + const uint8_t *pData; }; struct STSRowBuilder { @@ -117,9 +117,9 @@ struct STSRowBuilder { typedef enum { COL_VAL = 0, COL_NONE = 1, COL_NULL = 2 } EColValT; struct SColVal { - EColValT type; - uint32_t nData; - uint8_t *pData; + EColValT type; + uint32_t nData; + const uint8_t *pData; }; #if 1 //==================================== diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 4b1df237da..d421c452ca 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -96,13 +96,13 @@ static FORCE_INLINE int kvRowCmprFn(const void *p1, const void *p2) { } int32_t tTSRowGet(const STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) { - uint32_t n; - uint8_t *p; - uint8_t v; - int32_t bidx = iCol - 1; - STColumn *pTColumn = &pTSchema->columns[iCol]; - STSKVRow *pTSKVRow; - SKVIdx *pKVIdx; + uint32_t n; + const uint8_t *p; + uint8_t v; + int32_t bidx = iCol - 1; + STColumn *pTColumn = &pTSchema->columns[iCol]; + STSKVRow *pTSKVRow; + SKVIdx *pKVIdx; ASSERT(pTColumn->colId != 0); @@ -132,8 +132,8 @@ int32_t tTSRowGet(const STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal } } else { // get bitmap + p = pRow->pData; switch (pRow->flags & 0xf) { - p = pRow->pData; case TSROW_HAS_NULL | TSROW_HAS_NONE: v = GET_BIT1(p, bidx); if (v == 0) { @@ -181,8 +181,7 @@ int32_t tTSRowGet(const STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal // get real value p = p + pTColumn->offset; if (IS_VAR_DATA_TYPE(pTColumn->type)) { - p = pTSchema->flen + *(int32_t *)p; - tGetBinary(p, &p, &n); + tGetBinary(p + pTSchema->flen + *(int32_t *)p, &p, &n); } else { n = pTColumn->bytes; } -- GitLab