From 61994e7b5eca0c1c7569e6355d12f3db94e61aad Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 29 Jul 2024 18:12:57 +0800 Subject: [PATCH] merge conflict --- include/common/tmsg.h | 2 +- source/common/src/tmsg.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 4eb64785df..782b9a072d 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -3641,7 +3641,7 @@ int32_t tEncodeSTqOffsetVal(SEncoder* pEncoder, const STqOffsetVal* pOffsetVal); int32_t tDecodeSTqOffsetVal(SDecoder* pDecoder, STqOffsetVal* pOffsetVal); void tFormatOffset(char* buf, int32_t maxLen, const STqOffsetVal* pVal); bool tOffsetEqual(const STqOffsetVal* pLeft, const STqOffsetVal* pRight); -void tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight); +int32_t tOffsetCopy(STqOffsetVal* pLeft, const STqOffsetVal* pRight); void tOffsetDestroy(void* pVal); typedef struct { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index c5c0553abe..2fe6deaf14 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -9238,17 +9238,18 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) { return false; } -void tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) { +int32_t tOffsetCopy(STqOffsetVal *pLeft, const STqOffsetVal *pRight) { tOffsetDestroy(pLeft); *pLeft = *pRight; if (IS_VAR_DATA_TYPE(pRight->primaryKey.type)) { pLeft->primaryKey.pData = taosMemoryMalloc(pRight->primaryKey.nData); if (pLeft->primaryKey.pData == NULL) { uError("failed to allocate memory for offset"); - return; + return terrno; } (void)memcpy(pLeft->primaryKey.pData, pRight->primaryKey.pData, pRight->primaryKey.nData); } + return 0; } void tOffsetDestroy(void *param) {