Merge pull request #11955 from taosdata/fix/ZhiqiangWang/fix-14989-fix-new-compilation-errors

fix(os): fix new compilation errors.
This commit is contained in:
Zhiqiang Wang 2022-04-27 19:11:08 +08:00 committed by GitHub
commit cf8154551e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 138 additions and 101 deletions

View File

@ -219,8 +219,8 @@ endif(${BUILD_WITH_NURAFT})
# pthread # pthread
if(${BUILD_PTHREAD}) if(${BUILD_PTHREAD})
set(CMAKE_BUILD_TYPE release) set(CMAKE_BUILD_TYPE release)
add_definitions(-DPTW32_STATIC_LIB) add_definitions(-DPTW32_STATIC_LIB)
add_subdirectory(pthread EXCLUDE_FROM_ALL) add_subdirectory(pthread)
set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread) set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread)
add_library(pthread STATIC IMPORTED GLOBAL) add_library(pthread STATIC IMPORTED GLOBAL)
SET_PROPERTY(TARGET pthread PROPERTY IMPORTED_LOCATION ${LIBRARY_OUTPUT_PATH}/pthread.lib) SET_PROPERTY(TARGET pthread PROPERTY IMPORTED_LOCATION ${LIBRARY_OUTPUT_PATH}/pthread.lib)

View File

@ -121,13 +121,14 @@ typedef struct setConfRet {
DLL_EXPORT void taos_cleanup(void); DLL_EXPORT void taos_cleanup(void);
DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...); DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...);
DLL_EXPORT setConfRet taos_set_config(const char *config); DLL_EXPORT setConfRet taos_set_config(const char *config);
DLL_EXPORT int taos_init(void);
DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port); DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port);
DLL_EXPORT TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen, DLL_EXPORT TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen,
const char *db, int dbLen, uint16_t port); const char *db, int dbLen, uint16_t port);
DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port); DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port);
DLL_EXPORT void taos_close(TAOS *taos); DLL_EXPORT void taos_close(TAOS *taos);
const char *taos_data_type(int type); const char *taos_data_type(int type);
DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos); DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos);
DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length); DLL_EXPORT int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length);

View File

@ -1538,6 +1538,10 @@ int tDecodeSVCreateStbReq(SCoder* pCoder, SVCreateStbReq* pReq);
typedef struct SVDropStbReq { typedef struct SVDropStbReq {
// data // data
#ifdef WINDOWS
size_t avoidCompilationErrors;
#endif
} SVDropStbReq; } SVDropStbReq;
typedef struct SVCreateStbRsp { typedef struct SVCreateStbRsp {
@ -2117,7 +2121,7 @@ static FORCE_INLINE int32_t tDecodeSSchemaWrapper(SCoder* pDecoder, SSchemaWrapp
if (tDecodeI32v(pDecoder, &pSW->nCols) < 0) return -1; if (tDecodeI32v(pDecoder, &pSW->nCols) < 0) return -1;
if (tDecodeI32v(pDecoder, &pSW->sver) < 0) return -1; if (tDecodeI32v(pDecoder, &pSW->sver) < 0) return -1;
pSW->pSchema = (SSchema*)TCODER_MALLOC(pDecoder, sizeof(SSchema) * pSW->nCols); pSW->pSchema = (SSchema*)tCoderMalloc(pDecoder, sizeof(SSchema) * pSW->nCols);
if (pSW->pSchema == NULL) return -1; if (pSW->pSchema == NULL) return -1;
for (int32_t i = 0; i < pSW->nCols; i++) { for (int32_t i = 0; i < pSW->nCols; i++) {
if (tDecodeSSchema(pDecoder, &pSW->pSchema[i]) < 0) return -1; if (tDecodeSSchema(pDecoder, &pSW->pSchema[i]) < 0) return -1;

View File

@ -59,6 +59,7 @@ extern "C" {
#include <winsock.h> #include <winsock.h>
#endif #endif
#define __typeof(a) auto
#endif #endif

View File

@ -23,27 +23,21 @@ extern "C" {
#define TPOW2(x) ((x) * (x)) #define TPOW2(x) ((x) * (x))
#define TABS(x) ((x) > 0 ? (x) : -(x)) #define TABS(x) ((x) > 0 ? (x) : -(x))
#define TSWAP(a, b) \
do { \
__typeof(a) __tmp = (a); \
(a) = (b); \
(b) = __tmp; \
} while (0)
#ifdef WINDOWS #ifdef WINDOWS
#define TSWAP(a, b, c) \
do { \
c __tmp = (c)(a); \
(a) = (c)(b); \
(b) = __tmp; \
} while (0)
#define TMAX(a, b) (((a) > (b)) ? (a) : (b)) #define TMAX(a, b) (((a) > (b)) ? (a) : (b))
#define TMIN(a, b) (((a) < (b)) ? (a) : (b)) #define TMIN(a, b) (((a) < (b)) ? (a) : (b))
#define TRANGE(aa, bb, cc) ((aa) = TMAX((aa), (bb)),(aa) = TMIN((aa), (cc))) #define TRANGE(aa, bb, cc) ((aa) = TMAX((aa), (bb)),(aa) = TMIN((aa), (cc)))
#else #else
#define TSWAP(a, b, c) \
do { \
__typeof(a) __tmp = (a); \
(a) = (b); \
(b) = __tmp; \
} while (0)
#define TMAX(a, b) \ #define TMAX(a, b) \
({ \ ({ \
__typeof(a) __a = (a); \ __typeof(a) __a = (a); \
@ -51,12 +45,12 @@ extern "C" {
(__a > __b) ? __a : __b; \ (__a > __b) ? __a : __b; \
}) })
#define TMIN(a, b) \ #define TMIN(a, b) \
({ \ ({ \
__typeof(a) __a = (a); \ __typeof(a) __a = (a); \
__typeof(b) __b = (b); \ __typeof(b) __b = (b); \
(__a < __b) ? __a : __b; \ (__a < __b) ? __a : __b; \
}) })
#define TRANGE(a, b, c) \ #define TRANGE(a, b, c) \
({ \ ({ \

View File

@ -79,31 +79,52 @@ typedef struct {
#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos) #define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos)
#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE)) #define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE))
#define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE)) #define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE))
#define TCODER_MALLOC(PCODER, SIZE) \ // #define TCODER_MALLOC(PCODER, SIZE) \
({ \ // ({ \
void* ptr = NULL; \ // void* ptr = NULL; \
SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(*pMem) + (SIZE)); \ // SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(*pMem) + (SIZE)); \
if (pMem) { \ // if (pMem) { \
pMem->next = (PCODER)->mList; \ // pMem->next = (PCODER)->mList; \
(PCODER)->mList = pMem; \ // (PCODER)->mList = pMem; \
ptr = (void*)&pMem[1]; \ // ptr = (void*)&pMem[1]; \
} \ // } \
ptr; \ // ptr; \
}) // })
static FORCE_INLINE void* tCoderMalloc(SCoder* pCoder, int32_t size) {
void* ptr = NULL;
SCoderMem* pMem = (SCoderMem*)taosMemoryMalloc(sizeof(SCoderMem*) + size);
if (pMem) {
pMem->next = pCoder->mList;
pCoder->mList = pMem;
ptr = (void*)&pMem[1];
}
return ptr;
}
#define tEncodeSize(E, S, SIZE) \ #define tEncodeSize(E, S, SIZE, RET) \
({ \ do{ \
SCoder coder = {0}; \ SCoder coder = {0}; \
int ret = 0; \
tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \ tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
if ((E)(&coder, S) == 0) { \ if ((E)(&coder, S) == 0) { \
SIZE = coder.pos; \ SIZE = coder.pos; \
} else { \ } else { \
ret = -1; \ RET = -1; \
} \ } \
tCoderClear(&coder); \ tCoderClear(&coder); \
ret; \ }while(0)
}) // #define tEncodeSize(E, S, SIZE) \
// ({ \
// SCoder coder = {0}; \
// int ret = 0; \
// tCoderInit(&coder, TD_LITTLE_ENDIAN, NULL, 0, TD_ENCODER); \
// if ((E)(&coder, S) == 0) { \
// SIZE = coder.pos; \
// } else { \
// ret = -1; \
// } \
// tCoderClear(&coder); \
// ret; \
// })
void tCoderInit(SCoder* pCoder, td_endian_t endian, uint8_t* data, int32_t size, td_coder_t type); void tCoderInit(SCoder* pCoder, td_endian_t endian, uint8_t* data, int32_t size, td_coder_t type);
void tCoderClear(SCoder* pCoder); void tCoderClear(SCoder* pCoder);

View File

@ -254,8 +254,6 @@ extern int (*handleRequestRspFp[TDMT_MAX])(void*, const SDataBuf* pMsg, int32_t
int genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code); int genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code);
SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pReqObj); SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pReqObj);
int taos_init();
void* createTscObj(const char* user, const char* auth, const char* db, SAppInstInfo* pAppInfo); void* createTscObj(const char* user, const char* auth, const char* db, SAppInstInfo* pAppInfo);
void destroyTscObj(void* pObj); void destroyTscObj(void* pObj);
STscObj* acquireTscObj(int64_t rid); STscObj* acquireTscObj(int64_t rid);

View File

@ -188,8 +188,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
setResPrecision(&pRequest->body.resInfo, (*pQuery)->precision); setResPrecision(&pRequest->body.resInfo, (*pQuery)->precision);
} }
TSWAP(pRequest->dbList, (*pQuery)->pDbList, SArray*); TSWAP(pRequest->dbList, (*pQuery)->pDbList);
TSWAP(pRequest->tableList, (*pQuery)->pTableList, SArray*); TSWAP(pRequest->tableList, (*pQuery)->pTableList);
} }
return code; return code;

View File

@ -1,6 +1,7 @@
taos_cleanup taos_cleanup
taos_options taos_options
taos_set_config taos_set_config
taos_init
taos_connect taos_connect
taos_connect_l taos_connect_l
taos_connect_auth taos_connect_auth

View File

@ -3231,7 +3231,7 @@ int32_t tEncodeSMqCMCommitOffsetReq(SCoder *encoder, const SMqCMCommitOffsetReq
int32_t tDecodeSMqCMCommitOffsetReq(SCoder *decoder, SMqCMCommitOffsetReq *pReq) { int32_t tDecodeSMqCMCommitOffsetReq(SCoder *decoder, SMqCMCommitOffsetReq *pReq) {
if (tStartDecode(decoder) < 0) return -1; if (tStartDecode(decoder) < 0) return -1;
if (tDecodeI32(decoder, &pReq->num) < 0) return -1; if (tDecodeI32(decoder, &pReq->num) < 0) return -1;
pReq->offsets = (SMqOffset *)TCODER_MALLOC(decoder, sizeof(SMqOffset) * pReq->num); pReq->offsets = (SMqOffset *)tCoderMalloc(decoder, sizeof(SMqOffset) * pReq->num);
if (pReq->offsets == NULL) return -1; if (pReq->offsets == NULL) return -1;
for (int32_t i = 0; i < pReq->num; i++) { for (int32_t i = 0; i < pReq->num; i++) {
tDecodeSMqOffset(decoder, &pReq->offsets[i]); tDecodeSMqOffset(decoder, &pReq->offsets[i]);
@ -3514,7 +3514,7 @@ int tDecodeSVCreateTbBatchRsp(SCoder *pCoder, SVCreateTbBatchRsp *pRsp) {
if (tStartDecode(pCoder) < 0) return -1; if (tStartDecode(pCoder) < 0) return -1;
if (tDecodeI32v(pCoder, &pRsp->nRsps) < 0) return -1; if (tDecodeI32v(pCoder, &pRsp->nRsps) < 0) return -1;
pRsp->pRsps = (SVCreateTbRsp *)TCODER_MALLOC(pCoder, sizeof(*pRsp->pRsps) * pRsp->nRsps); pRsp->pRsps = (SVCreateTbRsp *)tCoderMalloc(pCoder, sizeof(*pRsp->pRsps) * pRsp->nRsps);
for (int32_t i = 0; i < pRsp->nRsps; i++) { for (int32_t i = 0; i < pRsp->nRsps; i++) {
if (tDecodeSVCreateTbRsp(pCoder, pRsp->pRsps + i) < 0) return -1; if (tDecodeSVCreateTbRsp(pCoder, pRsp->pRsps + i) < 0) return -1;
} }
@ -3743,7 +3743,7 @@ int tDecodeSVCreateTbBatchReq(SCoder *pCoder, SVCreateTbBatchReq *pReq) {
if (tStartDecode(pCoder) < 0) return -1; if (tStartDecode(pCoder) < 0) return -1;
if (tDecodeI32v(pCoder, &pReq->nReqs) < 0) return -1; if (tDecodeI32v(pCoder, &pReq->nReqs) < 0) return -1;
pReq->pReqs = (SVCreateTbReq *)TCODER_MALLOC(pCoder, sizeof(SVCreateTbReq) * pReq->nReqs); pReq->pReqs = (SVCreateTbReq *)tCoderMalloc(pCoder, sizeof(SVCreateTbReq) * pReq->nReqs);
if (pReq->pReqs == NULL) return -1; if (pReq->pReqs == NULL) return -1;
for (int iReq = 0; iReq < pReq->nReqs; iReq++) { for (int iReq = 0; iReq < pReq->nReqs; iReq++) {
if (tDecodeSVCreateTbReq(pCoder, pReq->pReqs + iReq) < 0) return -1; if (tDecodeSVCreateTbReq(pCoder, pReq->pReqs + iReq) < 0) return -1;

View File

@ -651,35 +651,35 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void *buf
switch (type) { switch (type) {
case TSDB_DATA_TYPE_INT: case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT: { case TSDB_DATA_TYPE_UINT: {
TSWAP(*(int32_t *)(pLeft), *(int32_t *)(pRight), int32_t); TSWAP(*(int32_t *)(pLeft), *(int32_t *)(pRight));
break; break;
} }
case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT: case TSDB_DATA_TYPE_UBIGINT:
case TSDB_DATA_TYPE_TIMESTAMP: { case TSDB_DATA_TYPE_TIMESTAMP: {
TSWAP(*(int64_t *)(pLeft), *(int64_t *)(pRight), int64_t); TSWAP(*(int64_t *)(pLeft), *(int64_t *)(pRight));
break; break;
} }
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
TSWAP(*(double *)(pLeft), *(double *)(pRight), double); TSWAP(*(double *)(pLeft), *(double *)(pRight));
break; break;
} }
case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT: { case TSDB_DATA_TYPE_USMALLINT: {
TSWAP(*(int16_t *)(pLeft), *(int16_t *)(pRight), int16_t); TSWAP(*(int16_t *)(pLeft), *(int16_t *)(pRight));
break; break;
} }
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
TSWAP(*(float *)(pLeft), *(float *)(pRight), float); TSWAP(*(float *)(pLeft), *(float *)(pRight));
break; break;
} }
case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_BOOL:
case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT: { case TSDB_DATA_TYPE_UTINYINT: {
TSWAP(*(int8_t *)(pLeft), *(int8_t *)(pRight), int8_t); TSWAP(*(int8_t *)(pLeft), *(int8_t *)(pRight));
break; break;
} }

View File

@ -395,7 +395,9 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
} }
} }
// get length // get length
if (tEncodeSize(tEncodeSVCreateStbReq, &req, contLen) < 0) { int32_t ret = 0;
tEncodeSize(tEncodeSVCreateStbReq, &req, contLen, ret);
if (ret < 0) {
return NULL; return NULL;
} }

View File

@ -230,8 +230,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
memcpy(pOld->pass, pNew->pass, TSDB_PASSWORD_LEN); memcpy(pOld->pass, pNew->pass, TSDB_PASSWORD_LEN);
pOld->updateTime = pNew->updateTime; pOld->updateTime = pNew->updateTime;
TSWAP(pOld->readDbs, pNew->readDbs, (void *)); TSWAP(pOld->readDbs, pNew->readDbs);
TSWAP(pOld->writeDbs, pNew->writeDbs, (void *)); TSWAP(pOld->writeDbs, pNew->writeDbs);
return 0; return 0;
} }

View File

@ -77,21 +77,25 @@ typedef struct {
tb_uid_t uid; tb_uid_t uid;
} STbDbKey; } STbDbKey;
typedef struct __attribute__((__packed__)) { #pragma pack(push, 1)
typedef struct {
tb_uid_t uid; tb_uid_t uid;
int32_t sver; int32_t sver;
} SSkmDbKey; } SSkmDbKey;
#pragma pack(pop)
typedef struct { typedef struct {
tb_uid_t suid; tb_uid_t suid;
tb_uid_t uid; tb_uid_t uid;
} SCtbIdxKey; } SCtbIdxKey;
typedef struct __attribute__((__packed__)) { #pragma pack(push, 1)
typedef struct {
tb_uid_t suid; tb_uid_t suid;
int16_t cid; int16_t cid;
char data[]; char data[];
} STagIdxKey; } STagIdxKey;
#pragma pack(pop)
typedef struct { typedef struct {
int64_t dtime; int64_t dtime;

View File

@ -158,7 +158,9 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
pKey = &tbDbKey; pKey = &tbDbKey;
kLen = sizeof(tbDbKey); kLen = sizeof(tbDbKey);
if (tEncodeSize(metaEncodeEntry, pME, vLen) < 0) { int32_t ret = 0;
tEncodeSize(metaEncodeEntry, pME, vLen, ret);
if (ret < 0) {
goto _err; goto _err;
} }
@ -250,7 +252,9 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
skmDbKey.sver = pSW->sver; skmDbKey.sver = pSW->sver;
// encode schema // encode schema
if (tEncodeSize(tEncodeSSchemaWrapper, pSW, vLen) < 0) return -1; int32_t ret = 0;
tEncodeSize(tEncodeSSchemaWrapper, pSW, vLen, ret);
if (ret < 0) return -1;
pVal = taosMemoryMalloc(vLen); pVal = taosMemoryMalloc(vLen);
if (pVal == NULL) { if (pVal == NULL) {
rcode = -1; rcode = -1;

View File

@ -454,7 +454,7 @@ void tsdbResetReadHandle(tsdbReaderT queryHandle, SQueryTableDataCond* pCond) {
if (emptyQueryTimewindow(pTsdbReadHandle)) { if (emptyQueryTimewindow(pTsdbReadHandle)) {
if (pCond->order != pTsdbReadHandle->order) { if (pCond->order != pTsdbReadHandle->order) {
pTsdbReadHandle->order = pCond->order; pTsdbReadHandle->order = pCond->order;
TSWAP(pTsdbReadHandle->window.skey, pTsdbReadHandle->window.ekey, int64_t); TSWAP(pTsdbReadHandle->window.skey, pTsdbReadHandle->window.ekey);
} }
return; return;
@ -924,7 +924,7 @@ static bool hasMoreDataInCache(STsdbReadHandle* pHandle) {
pHandle->cur.mixBlock = true; pHandle->cur.mixBlock = true;
if (!ASCENDING_TRAVERSE(pHandle->order)) { if (!ASCENDING_TRAVERSE(pHandle->order)) {
TSWAP(win->skey, win->ekey, TSKEY); TSWAP(win->skey, win->ekey);
} }
return true; return true;
@ -1203,7 +1203,7 @@ static int32_t handleDataMergeIfNeeded(STsdbReadHandle* pTsdbReadHandle, SBlock*
// update the last key value // update the last key value
pCheckInfo->lastKey = cur->win.ekey + step; pCheckInfo->lastKey = cur->win.ekey + step;
if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) { if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) {
TSWAP(cur->win.skey, cur->win.ekey, TSKEY); TSWAP(cur->win.skey, cur->win.ekey);
} }
cur->mixBlock = true; cur->mixBlock = true;
@ -1701,7 +1701,7 @@ static void copyAllRemainRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, STa
int32_t end = endPos; int32_t end = endPos;
if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) { if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) {
TSWAP(start, end, int32_t); TSWAP(start, end);
} }
assert(pTsdbReadHandle->outputCapacity >= (end - start + 1)); assert(pTsdbReadHandle->outputCapacity >= (end - start + 1));
@ -1932,7 +1932,7 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
((pos < endPos || cur->lastKey < pTsdbReadHandle->window.ekey) && !ASCENDING_TRAVERSE(pTsdbReadHandle->order))); ((pos < endPos || cur->lastKey < pTsdbReadHandle->window.ekey) && !ASCENDING_TRAVERSE(pTsdbReadHandle->order)));
if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) { if (!ASCENDING_TRAVERSE(pTsdbReadHandle->order)) {
TSWAP(cur->win.skey, cur->win.ekey, TSKEY); TSWAP(cur->win.skey, cur->win.ekey);
} }
moveDataToFront(pTsdbReadHandle, numOfRows, numOfCols); moveDataToFront(pTsdbReadHandle, numOfRows, numOfCols);

View File

@ -369,7 +369,8 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
tCoderClear(&coder); tCoderClear(&coder);
// prepare rsp // prepare rsp
tEncodeSize(tEncodeSVCreateTbBatchRsp, &rsp, pRsp->contLen); int32_t ret = 0;
tEncodeSize(tEncodeSVCreateTbBatchRsp, &rsp, pRsp->contLen, ret);
pRsp->pCont = rpcMallocCont(pRsp->contLen); pRsp->pCont = rpcMallocCont(pRsp->contLen);
if (pRsp->pCont == NULL) { if (pRsp->pCont == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;

View File

@ -2100,7 +2100,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
// //
// pQueryAttr->order.order = TSDB_ORDER_ASC; // pQueryAttr->order.order = TSDB_ORDER_ASC;
// if (pQueryAttr->window.skey > pQueryAttr->window.ekey) { // if (pQueryAttr->window.skey > pQueryAttr->window.ekey) {
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); // TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// } // }
// //
// pQueryAttr->needReverseScan = false; // pQueryAttr->needReverseScan = false;
@ -2110,7 +2110,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
// if (pQueryAttr->groupbyColumn && pQueryAttr->order.order == TSDB_ORDER_DESC) { // if (pQueryAttr->groupbyColumn && pQueryAttr->order.order == TSDB_ORDER_DESC) {
// pQueryAttr->order.order = TSDB_ORDER_ASC; // pQueryAttr->order.order = TSDB_ORDER_ASC;
// if (pQueryAttr->window.skey > pQueryAttr->window.ekey) { // if (pQueryAttr->window.skey > pQueryAttr->window.ekey) {
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); // TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// } // }
// //
// pQueryAttr->needReverseScan = false; // pQueryAttr->needReverseScan = false;
@ -2135,7 +2135,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
// //qDebug(msg, pQInfo->qId, "only-first", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, // //qDebug(msg, pQInfo->qId, "only-first", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey,
//// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); //// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
// //
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); // TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// doUpdateLastKey(pQueryAttr); // doUpdateLastKey(pQueryAttr);
// } // }
// //
@ -2146,7 +2146,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
// //qDebug(msg, pQInfo->qId, "only-last", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey, // //qDebug(msg, pQInfo->qId, "only-last", pQueryAttr->order.order, TSDB_ORDER_DESC, pQueryAttr->window.skey,
//// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); //// pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey);
// //
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); // TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// doUpdateLastKey(pQueryAttr); // doUpdateLastKey(pQueryAttr);
// } // }
// //
@ -2162,7 +2162,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
//// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, //// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey,
/// pQueryAttr->window.skey); /// pQueryAttr->window.skey);
// //
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); // TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// doUpdateLastKey(pQueryAttr); // doUpdateLastKey(pQueryAttr);
// } // }
// //
@ -2174,7 +2174,7 @@ static int32_t updateBlockLoadStatus(STaskAttr* pQuery, int32_t status) {
//// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, //// pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey,
/// pQueryAttr->window.skey); /// pQueryAttr->window.skey);
// //
// TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); // TSWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// doUpdateLastKey(pQueryAttr); // doUpdateLastKey(pQueryAttr);
// } // }
// //
@ -2673,7 +2673,7 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo* pTableQueryInfo)
return; return;
} }
// TSWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey, TSKEY); // TSWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey);
// pTableQueryInfo->lastKey = pTableQueryInfo->win.skey; // pTableQueryInfo->lastKey = pTableQueryInfo->win.skey;
// SWITCH_ORDER(pTableQueryInfo->cur.order); // SWITCH_ORDER(pTableQueryInfo->cur.order);
@ -6652,7 +6652,7 @@ static int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableS
//todo work around a problem, remove it later //todo work around a problem, remove it later
if ((pCond->order == TSDB_ORDER_ASC && pCond->twindow.skey > pCond->twindow.ekey) || if ((pCond->order == TSDB_ORDER_ASC && pCond->twindow.skey > pCond->twindow.ekey) ||
(pCond->order == TSDB_ORDER_DESC && pCond->twindow.skey < pCond->twindow.ekey)) { (pCond->order == TSDB_ORDER_DESC && pCond->twindow.skey < pCond->twindow.ekey)) {
TSWAP(pCond->twindow.skey, pCond->twindow.ekey, int64_t); TSWAP(pCond->twindow.skey, pCond->twindow.ekey);
} }
#endif #endif

View File

@ -266,7 +266,7 @@ static void prepareForDescendingScan(STableScanInfo* pTableScanInfo, SqlFunction
// setupQueryRangeForReverseScan(pTableScanInfo); // setupQueryRangeForReverseScan(pTableScanInfo);
STimeWindow* pTWindow = &pTableScanInfo->cond.twindow; STimeWindow* pTWindow = &pTableScanInfo->cond.twindow;
TSWAP(pTWindow->skey, pTWindow->ekey, int64_t); TSWAP(pTWindow->skey, pTWindow->ekey);
pTableScanInfo->cond.order = TSDB_ORDER_DESC; pTableScanInfo->cond.order = TSDB_ORDER_DESC;
} }

View File

@ -307,7 +307,7 @@ static int32_t buildOutput(SInsertParseContext* pCxt) {
taosHashGetDup(pCxt->pVgroupsHashObj, (const char*)&src->vgId, sizeof(src->vgId), &dst->vg); taosHashGetDup(pCxt->pVgroupsHashObj, (const char*)&src->vgId, sizeof(src->vgId), &dst->vg);
dst->numOfTables = src->numOfTables; dst->numOfTables = src->numOfTables;
dst->size = src->size; dst->size = src->size;
TSWAP(dst->pData, src->pData, char*); TSWAP(dst->pData, src->pData);
buildMsgHeader(src, dst); buildMsgHeader(src, dst);
taosArrayPush(pCxt->pOutput->pDataBlocks, &dst); taosArrayPush(pCxt->pOutput->pDataBlocks, &dst);
} }

View File

@ -159,9 +159,10 @@ static int32_t createDataBlock(size_t defaultSize, int32_t rowSize, int32_t star
int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) { int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) {
SCoder coder = {0}; SCoder coder = {0};
char* pBuf; char* pBuf;
int32_t len; int32_t len;
tEncodeSize(tEncodeSVCreateTbReq, pCreateTbReq, len); int32_t ret = 0;
tEncodeSize(tEncodeSVCreateTbReq, pCreateTbReq, len, ret);
if (pBlocks->nAllocSize - pBlocks->size < len) { if (pBlocks->nAllocSize - pBlocks->size < len) {
pBlocks->nAllocSize += len + pBlocks->rowSize; pBlocks->nAllocSize += len + pBlocks->rowSize;
char* pTmp = taosMemoryRealloc(pBlocks->pData, pBlocks->nAllocSize); char* pTmp = taosMemoryRealloc(pBlocks->pData, pBlocks->nAllocSize);

View File

@ -2049,10 +2049,10 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
} }
strcpy(pTable->table.dbName, pInfo->pDbName); strcpy(pTable->table.dbName, pInfo->pDbName);
strcpy(pTable->table.tableName, pInfo->pTableName); strcpy(pTable->table.tableName, pInfo->pTableName);
TSWAP(pTable->pMeta, pInfo->pRollupTableMeta, STableMeta*); TSWAP(pTable->pMeta, pInfo->pRollupTableMeta);
pSelect->pFromTable = (SNode*)pTable; pSelect->pFromTable = (SNode*)pTable;
TSWAP(pSelect->pProjectionList, pInfo->pFuncs, SNodeList*); TSWAP(pSelect->pProjectionList, pInfo->pFuncs);
SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION);
if (NULL == pSelect->pProjectionList || NULL == pFunc) { if (NULL == pSelect->pProjectionList || NULL == pFunc) {
nodesDestroyNode(pSelect); nodesDestroyNode(pSelect);
@ -2069,9 +2069,9 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
pSelect->pWindow = (SNode*)pInterval; pSelect->pWindow = (SNode*)pInterval;
TSWAP(pInterval->pInterval, pInfo->pInterval, SNode*); TSWAP(pInterval->pInterval, pInfo->pInterval);
TSWAP(pInterval->pOffset, pInfo->pOffset, SNode*); TSWAP(pInterval->pOffset, pInfo->pOffset);
TSWAP(pInterval->pSliding, pInfo->pSliding, SNode*); TSWAP(pInterval->pSliding, pInfo->pSliding);
pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN); pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pInterval->pCol) { if (NULL == pInterval->pCol) {
nodesDestroyNode(pSelect); nodesDestroyNode(pSelect);
@ -3282,7 +3282,8 @@ static int32_t serializeVgroupTablesBatch(SVgroupTablesBatch* pTbBatch, SArray*
int tlen; int tlen;
SCoder coder = {0}; SCoder coder = {0};
tEncodeSize(tEncodeSVCreateTbBatchReq, &pTbBatch->req, tlen); int32_t ret = 0;
tEncodeSize(tEncodeSVCreateTbBatchReq, &pTbBatch->req, tlen, ret);
tlen += sizeof(SMsgHead); //+ tSerializeSVCreateTbBatchReq(NULL, &(pTbBatch->req)); tlen += sizeof(SMsgHead); //+ tSerializeSVCreateTbBatchReq(NULL, &(pTbBatch->req));
void* buf = taosMemoryMalloc(tlen); void* buf = taosMemoryMalloc(tlen);
if (NULL == buf) { if (NULL == buf) {
@ -3696,7 +3697,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
default: default:
pQuery->execMode = QUERY_EXEC_MODE_RPC; pQuery->execMode = QUERY_EXEC_MODE_RPC;
if (NULL != pCxt->pCmdMsg) { if (NULL != pCxt->pCmdMsg) {
TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg, SCmdMsgInfo*); TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg);
pQuery->msgType = pQuery->pCmdMsg->msgType; pQuery->msgType = pQuery->pCmdMsg->msgType;
} }
break; break;

View File

@ -251,8 +251,8 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
TSWAP(pScan->pMeta, pRealTable->pMeta, STableMeta*); TSWAP(pScan->pMeta, pRealTable->pMeta);
TSWAP(pScan->pVgroupList, pRealTable->pVgroupList, SVgroupsInfo*); TSWAP(pScan->pVgroupList, pRealTable->pVgroupList);
pScan->scanSeq[0] = 1; pScan->scanSeq[0] = 1;
pScan->scanSeq[1] = 0; pScan->scanSeq[1] = 0;
pScan->scanRange = TSWINDOW_INITIALIZER; pScan->scanRange = TSWINDOW_INITIALIZER;
@ -954,7 +954,7 @@ static int32_t createVnodeModifLogicNode(SLogicPlanContext* pCxt, SVnodeModifOpS
if (NULL == pModif) { if (NULL == pModif) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
TSWAP(pModif->pDataBlocks, pStmt->pDataBlocks, SArray*); TSWAP(pModif->pDataBlocks, pStmt->pDataBlocks);
pModif->msgType = getMsgType(pStmt->sqlNodeType); pModif->msgType = getMsgType(pStmt->sqlNodeType);
*pLogicNode = (SLogicNode*)pModif; *pLogicNode = (SLogicNode*)pModif;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;

View File

@ -246,7 +246,7 @@ static int32_t cpdMergeConds(SNode** pDst, SNodeList** pSrc) {
static int32_t cpdCondAppend(SNode** pCond, SNode** pAdditionalCond) { static int32_t cpdCondAppend(SNode** pCond, SNode** pAdditionalCond) {
if (NULL == *pCond) { if (NULL == *pCond) {
TSWAP(*pCond, *pAdditionalCond, SNode*); TSWAP(*pCond, *pAdditionalCond);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -1097,7 +1097,7 @@ static int32_t createDataInserter(SPhysiPlanContext* pCxt, SVgDataBlocks* pBlock
pInserter->numOfTables = pBlocks->numOfTables; pInserter->numOfTables = pBlocks->numOfTables;
pInserter->size = pBlocks->size; pInserter->size = pBlocks->size;
TSWAP(pInserter->pData, pBlocks->pData, char*); TSWAP(pInserter->pData, pBlocks->pData);
*pSink = (SDataSinkNode*)pInserter; *pSink = (SDataSinkNode*)pInserter;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;

View File

@ -65,7 +65,7 @@ static SLogicSubplan* splCreateScanSubplan(SSplitContext* pCxt, SScanLogicNode*
pSubplan->id.groupId = pCxt->groupId; pSubplan->id.groupId = pCxt->groupId;
pSubplan->subplanType = SUBPLAN_TYPE_SCAN; pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
pSubplan->pNode = (SLogicNode*)nodesCloneNode(pScan); pSubplan->pNode = (SLogicNode*)nodesCloneNode(pScan);
TSWAP(pSubplan->pVgroupList, ((SScanLogicNode*)pSubplan->pNode)->pVgroupList, SVgroupsInfo*); TSWAP(pSubplan->pVgroupList, ((SScanLogicNode*)pSubplan->pNode)->pVgroupList);
SPLIT_FLAG_SET_MASK(pSubplan->splitFlag, flag); SPLIT_FLAG_SET_MASK(pSubplan->splitFlag, flag);
return pSubplan; return pSubplan;
} }
@ -406,8 +406,7 @@ int32_t splitLogicPlan(SPlanContext* pCxt, SLogicNode* pLogicNode, SLogicSubplan
} }
if (QUERY_NODE_LOGIC_PLAN_VNODE_MODIF == nodeType(pLogicNode)) { if (QUERY_NODE_LOGIC_PLAN_VNODE_MODIF == nodeType(pLogicNode)) {
pSubplan->subplanType = SUBPLAN_TYPE_MODIFY; pSubplan->subplanType = SUBPLAN_TYPE_MODIFY;
TSWAP(((SVnodeModifLogicNode*)pLogicNode)->pDataBlocks, ((SVnodeModifLogicNode*)pSubplan->pNode)->pDataBlocks, TSWAP(((SVnodeModifLogicNode*)pLogicNode)->pDataBlocks, ((SVnodeModifLogicNode*)pSubplan->pNode)->pDataBlocks);
SArray*);
} else { } else {
pSubplan->subplanType = SUBPLAN_TYPE_SCAN; pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
} }

View File

@ -67,6 +67,12 @@ int32_t tsem_wait(tsem_t* sem) {
return ret; return ret;
} }
int32_t tsem_timewait(tsem_t* sem, int64_t nanosecs) {
int ret = 0;
return ret;
}
#elif defined(_TD_DARWIN_64) #elif defined(_TD_DARWIN_64)
/* /*

View File

@ -230,7 +230,7 @@ static int32_t tSStructA_v1_decode(SCoder *pCoder, SStructA_v1 *pSAV1) {
const char *tstr; const char *tstr;
uint64_t len; uint64_t len;
if (tDecodeCStrAndLen(pCoder, &tstr, &len) < 0) return -1; if (tDecodeCStrAndLen(pCoder, &tstr, &len) < 0) return -1;
pSAV1->A_c = (char *)TCODER_MALLOC(pCoder, len + 1); pSAV1->A_c = (char *)tCoderMalloc(pCoder, len + 1);
memcpy(pSAV1->A_c, tstr, len + 1); memcpy(pSAV1->A_c, tstr, len + 1);
tEndDecode(pCoder); tEndDecode(pCoder);
@ -269,7 +269,7 @@ static int32_t tSStructA_v2_decode(SCoder *pCoder, SStructA_v2 *pSAV2) {
const char *tstr; const char *tstr;
uint64_t len; uint64_t len;
if (tDecodeCStrAndLen(pCoder, &tstr, &len) < 0) return -1; if (tDecodeCStrAndLen(pCoder, &tstr, &len) < 0) return -1;
pSAV2->A_c = (char *)TCODER_MALLOC(pCoder, len + 1); pSAV2->A_c = (char *)tCoderMalloc(pCoder, len + 1);
memcpy(pSAV2->A_c, tstr, len + 1); memcpy(pSAV2->A_c, tstr, len + 1);
// ------------------------NEW FIELDS DECODE------------------------------- // ------------------------NEW FIELDS DECODE-------------------------------
@ -305,7 +305,7 @@ static int32_t tSFinalReq_v1_encode(SCoder *pCoder, const SFinalReq_v1 *ps1) {
static int32_t tSFinalReq_v1_decode(SCoder *pCoder, SFinalReq_v1 *ps1) { static int32_t tSFinalReq_v1_decode(SCoder *pCoder, SFinalReq_v1 *ps1) {
if (tStartDecode(pCoder) < 0) return -1; if (tStartDecode(pCoder) < 0) return -1;
ps1->pA = (SStructA_v1 *)TCODER_MALLOC(pCoder, sizeof(*(ps1->pA))); ps1->pA = (SStructA_v1 *)tCoderMalloc(pCoder, sizeof(*(ps1->pA)));
if (tSStructA_v1_decode(pCoder, ps1->pA) < 0) return -1; if (tSStructA_v1_decode(pCoder, ps1->pA) < 0) return -1;
if (tDecodeI32(pCoder, &ps1->v_a) < 0) return -1; if (tDecodeI32(pCoder, &ps1->v_a) < 0) return -1;
if (tDecodeI8(pCoder, &ps1->v_b) < 0) return -1; if (tDecodeI8(pCoder, &ps1->v_b) < 0) return -1;
@ -339,7 +339,7 @@ static int32_t tSFinalReq_v2_encode(SCoder *pCoder, const SFinalReq_v2 *ps2) {
static int32_t tSFinalReq_v2_decode(SCoder *pCoder, SFinalReq_v2 *ps2) { static int32_t tSFinalReq_v2_decode(SCoder *pCoder, SFinalReq_v2 *ps2) {
if (tStartDecode(pCoder) < 0) return -1; if (tStartDecode(pCoder) < 0) return -1;
ps2->pA = (SStructA_v2 *)TCODER_MALLOC(pCoder, sizeof(*(ps2->pA))); ps2->pA = (SStructA_v2 *)tCoderMalloc(pCoder, sizeof(*(ps2->pA)));
if (tSStructA_v2_decode(pCoder, ps2->pA) < 0) return -1; if (tSStructA_v2_decode(pCoder, ps2->pA) < 0) return -1;
if (tDecodeI32(pCoder, &ps2->v_a) < 0) return -1; if (tDecodeI32(pCoder, &ps2->v_a) < 0) return -1;
if (tDecodeI8(pCoder, &ps2->v_b) < 0) return -1; if (tDecodeI8(pCoder, &ps2->v_b) < 0) return -1;

View File

@ -111,6 +111,5 @@ void shellTestNetWork();
// shellMain.c // shellMain.c
extern SShellObj shell; extern SShellObj shell;
extern void taos_init();
#endif /*_TD_SHELL_INT_H_*/ #endif /*_TD_SHELL_INT_H_*/