diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index a0c16f062d496932c01f8f6edc03f6d14fca2bb1..e0c073d153bba06ab62277817a3c069829d8023a 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -106,6 +106,8 @@ void tscAddSpecialColumnForSelect(SSqlCmd* pCmd, int32_t outputColIndex, int16_t SSchema* pColSchema, int16_t isTag); void addRequiredTagColumn(SSqlCmd* pCmd, int32_t tagColIndex, int32_t tableIndex); + +//TODO refactor, remove void SStringFree(SString* str); void SStringCopy(SString* pDest, const SString* pSrc); SString SStringCreate(const char* str); diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index d217d0958833fad40c2a2aaf7cb135e43222f56c..a18a98c8c176c8b08d1664d04ac86014f51aad3d 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -26,7 +26,7 @@ #include "tschemautil.h" #include "tsocket.h" -static int32_t getToStringLength(char *pData, int32_t length, int32_t type) { +static int32_t getToStringLength(const char *pData, int32_t length, int32_t type) { char buf[512] = {0}; int32_t len = 0; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index fd23b183b1065e96ebb82b044219648b2be90e42..25564a75ea7c6cf362f9ac77c47521989a09287f 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1643,7 +1643,7 @@ int32_t SStringEnsureRemain(SString* pStr, int32_t size) { } // remain space is insufficient, allocate more spaces - int32_t inc = (size < MIN_ALLOC_SIZE) ? size : MIN_ALLOC_SIZE; + int32_t inc = (size >= MIN_ALLOC_SIZE) ? size : MIN_ALLOC_SIZE; if (inc < (pStr->alloc >> 1)) { inc = (pStr->alloc >> 1); } @@ -1670,6 +1670,7 @@ int32_t SStringEnsureRemain(SString* pStr, int32_t size) { } memset(tmp + pStr->n, 0, inc); + pStr->alloc = newsize; pStr->z = tmp; return TSDB_CODE_SUCCESS; diff --git a/src/util/src/tnote.c b/src/util/src/tnote.c index 68228d377a7d1f8d2da8aa0127752ad4c07622c0..709ac2742e5833a68194c8760cd65f45c27aebd4 100644 --- a/src/util/src/tnote.c +++ b/src/util/src/tnote.c @@ -13,22 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "os.h" #include "tutil.h" #include "tglobalcfg.h"