This commit is contained in:
Hongze Cheng 2022-01-02 10:34:31 +00:00
parent 729aabca15
commit eaca069a45
1 changed files with 10 additions and 0 deletions

View File

@ -125,6 +125,7 @@ static int tDecodeDouble(SCoder* pDecoder, double* val);
static int tDecodeBinary(SCoder* pDecoder, const void** val, uint64_t* len);
static int tDecodeCStrAndLen(SCoder* pDecoder, const char** val, uint64_t* len);
static int tDecodeCStr(SCoder* pDecoder, const char** val);
static int tDecodeCStrTo(SCoder* pDecoder, char* val);
/* ------------------------ IMPL ------------------------ */
#define TD_ENCODE_MACRO(CODER, VAL, TYPE, BITS) \
@ -385,6 +386,15 @@ static FORCE_INLINE int tDecodeCStr(SCoder* pDecoder, const char** val) {
return tDecodeCStrAndLen(pDecoder, val, &len);
}
static int tDecodeCStrTo(SCoder* pDecoder, char* val) {
const char* pStr;
uint64_t len;
if (tDecodeCStrAndLen(pDecoder, &pStr, &len) < 0) return -1;
memcpy(val, pStr, len+1);
return 0;
}
#ifdef __cplusplus
}
#endif