TD-1090 compile client in windows 32 platform
This commit is contained in:
parent
2d02bb7e6f
commit
e53ebe94df
|
@ -110,7 +110,7 @@ IF (TD_WINDOWS)
|
||||||
ADD_DEFINITIONS(-D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
ADD_DEFINITIONS(-D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
SET(CMAKE_GENERATOR "NMake Makefiles" CACHE INTERNAL "" FORCE)
|
SET(CMAKE_GENERATOR "NMake Makefiles" CACHE INTERNAL "" FORCE)
|
||||||
IF (NOT TD_GODLL)
|
IF (NOT TD_GODLL)
|
||||||
SET(COMMON_FLAGS "/nologo /WX /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-")
|
SET(COMMON_FLAGS "/nologo /WX /wd4018 /wd2220 /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-")
|
||||||
SET(DEBUG_FLAGS "/Zi /W3 /GL")
|
SET(DEBUG_FLAGS "/Zi /W3 /GL")
|
||||||
SET(RELEASE_FLAGS "/W0 /GL")
|
SET(RELEASE_FLAGS "/W0 /GL")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
/* Generate the OS-and-debug-mode-specific library name */
|
/* Generate the OS-and-debug-mode-specific library name */
|
||||||
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
|
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
|
||||||
//#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
|
//#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
|
||||||
#pragma comment(lib, _MSVCLIBX_LIB)
|
//#pragma comment(lib, _MSVCLIBX_LIB)
|
||||||
|
|
||||||
/* Library-specific routine used internally by many standard routines */
|
/* Library-specific routine used internally by many standard routines */
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
|
@ -907,7 +907,7 @@ static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer,
|
||||||
savePrevRecordAndSetupFillInfo(pLocalReducer, pQueryInfo, pLocalReducer->pFillInfo);
|
savePrevRecordAndSetupFillInfo(pLocalReducer, pQueryInfo, pLocalReducer->pFillInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pRes->data, pBeforeFillData->data, pRes->numOfRows * pLocalReducer->finalRowSize);
|
memcpy(pRes->data, pBeforeFillData->data, (size_t)(pRes->numOfRows * pLocalReducer->finalRowSize));
|
||||||
|
|
||||||
pRes->numOfClauseTotal += pRes->numOfRows;
|
pRes->numOfClauseTotal += pRes->numOfRows;
|
||||||
pBeforeFillData->num = 0;
|
pBeforeFillData->num = 0;
|
||||||
|
@ -943,7 +943,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
|
||||||
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
|
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
|
||||||
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i);
|
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i);
|
||||||
memmove(pResPages[i]->data, pResPages[i]->data + pField->bytes * pQueryInfo->limit.offset,
|
memmove(pResPages[i]->data, pResPages[i]->data + pField->bytes * pQueryInfo->limit.offset,
|
||||||
newRows * pField->bytes);
|
(size_t)(newRows * pField->bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,7 +988,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
|
||||||
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
|
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
|
||||||
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i);
|
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i);
|
||||||
int16_t offset = getColumnModelOffset(pLocalReducer->resColModel, i);
|
int16_t offset = getColumnModelOffset(pLocalReducer->resColModel, i);
|
||||||
memcpy(pRes->data + offset * pRes->numOfRows, pResPages[i]->data, pField->bytes * pRes->numOfRows);
|
memcpy(pRes->data + offset * pRes->numOfRows, pResPages[i]->data, (size_t)(pField->bytes * pRes->numOfRows));
|
||||||
}
|
}
|
||||||
} else { // todo bug??
|
} else { // todo bug??
|
||||||
reversedCopyFromInterpolationToDstBuf(pQueryInfo, pRes, pResPages, pLocalReducer);
|
reversedCopyFromInterpolationToDstBuf(pQueryInfo, pRes, pResPages, pLocalReducer);
|
||||||
|
|
|
@ -708,7 +708,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
if (pColFilter->filterstr) {
|
if (pColFilter->filterstr) {
|
||||||
pFilterMsg->len = htobe64(pColFilter->len);
|
pFilterMsg->len = htobe64(pColFilter->len);
|
||||||
memcpy(pMsg, (void *)pColFilter->pz, pColFilter->len + 1);
|
memcpy(pMsg, (void *)pColFilter->pz, (size_t)(pColFilter->len + 1));
|
||||||
pMsg += (pColFilter->len + 1); // append the additional filter binary info
|
pMsg += (pColFilter->len + 1); // append the additional filter binary info
|
||||||
} else {
|
} else {
|
||||||
pFilterMsg->lowerBndi = htobe64(pColFilter->lowerBndi);
|
pFilterMsg->lowerBndi = htobe64(pColFilter->lowerBndi);
|
||||||
|
|
|
@ -623,7 +623,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
||||||
|
|
||||||
// keep the results in memory
|
// keep the results in memory
|
||||||
if (numOfRows > 0) {
|
if (numOfRows > 0) {
|
||||||
size_t validLen = pSupporter->tagSize * pRes->numOfRows;
|
size_t validLen = (size_t)(pSupporter->tagSize * pRes->numOfRows);
|
||||||
size_t length = pSupporter->totalLen + validLen;
|
size_t length = pSupporter->totalLen + validLen;
|
||||||
|
|
||||||
// todo handle memory error
|
// todo handle memory error
|
||||||
|
@ -748,7 +748,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numOfRows > 0) { // write the compressed timestamp to disk file
|
if (numOfRows > 0) { // write the compressed timestamp to disk file
|
||||||
fwrite(pRes->data, pRes->numOfRows, 1, pSupporter->f);
|
fwrite(pRes->data, (size_t)pRes->numOfRows, 1, pSupporter->f);
|
||||||
fclose(pSupporter->f);
|
fclose(pSupporter->f);
|
||||||
pSupporter->f = NULL;
|
pSupporter->f = NULL;
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,11 @@ void wordfree(wordexp_t *pwordexp);
|
||||||
#define atomic_exchange_16(ptr, val) _InterlockedExchange16((short volatile*)(ptr), (short)(val))
|
#define atomic_exchange_16(ptr, val) _InterlockedExchange16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_exchange_32(ptr, val) _InterlockedExchange((long volatile*)(ptr), (long)(val))
|
#define atomic_exchange_32(ptr, val) _InterlockedExchange((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
|
#ifdef _InterlockedExchangePointer
|
||||||
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
|
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
|
||||||
|
#else
|
||||||
|
#define atomic_exchange_ptr(ptr, val) _InlineInterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _TD_GO_DLL_
|
#ifdef _TD_GO_DLL_
|
||||||
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
|
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
|
||||||
|
@ -247,16 +251,29 @@ void wordfree(wordexp_t *pwordexp);
|
||||||
long interlocked_add_fetch_32(long volatile *ptr, long val);
|
long interlocked_add_fetch_32(long volatile *ptr, long val);
|
||||||
__int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
|
__int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
|
||||||
|
|
||||||
|
char interlocked_and_fetch_8(char volatile* ptr, char val);
|
||||||
|
short interlocked_and_fetch_16(short volatile* ptr, short val);
|
||||||
|
long interlocked_and_fetch_32(long volatile* ptr, long val);
|
||||||
|
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
char interlocked_or_fetch_8(char volatile* ptr, char val);
|
||||||
|
short interlocked_or_fetch_16(short volatile* ptr, short val);
|
||||||
|
long interlocked_or_fetch_32(long volatile* ptr, long val);
|
||||||
|
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
char interlocked_xor_fetch_8(char volatile* ptr, char val);
|
||||||
|
short interlocked_xor_fetch_16(short volatile* ptr, short val);
|
||||||
|
long interlocked_xor_fetch_32(long volatile* ptr, long val);
|
||||||
|
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
#define atomic_add_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), (char)(val))
|
#define atomic_add_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_add_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), (short)(val))
|
#define atomic_add_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_add_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_add_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_add_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_add_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_add_fetch_ptr atomic_add_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_add_fetch_ptr atomic_add_fetch_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _TD_GO_DLL_
|
#ifdef _TD_GO_DLL_
|
||||||
#define atomic_fetch_add_8 __sync_fetch_and_ad
|
#define atomic_fetch_add_8 __sync_fetch_and_ad
|
||||||
#define atomic_fetch_add_16 __sync_fetch_and_add
|
#define atomic_fetch_add_16 __sync_fetch_and_add
|
||||||
|
@ -264,145 +281,74 @@ void wordfree(wordexp_t *pwordexp);
|
||||||
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
|
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
|
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
#endif
|
||||||
|
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
|
||||||
|
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_add_ptr atomic_fetch_add_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_add_ptr atomic_fetch_add_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define atomic_sub_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), -(char)(val))
|
#define atomic_sub_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), -(char)(val))
|
||||||
#define atomic_sub_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), -(short)(val))
|
#define atomic_sub_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), -(short)(val))
|
||||||
#define atomic_sub_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), -(long)(val))
|
#define atomic_sub_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), -(long)(val))
|
||||||
#define atomic_sub_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), -(__int64)(val))
|
#define atomic_sub_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), -(__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_sub_fetch_ptr atomic_sub_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_sub_fetch_ptr atomic_sub_fetch_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define atomic_fetch_sub_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), -(char)(val))
|
#define atomic_fetch_sub_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), -(char)(val))
|
||||||
#define atomic_fetch_sub_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), -(short)(val))
|
#define atomic_fetch_sub_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), -(short)(val))
|
||||||
#define atomic_fetch_sub_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), -(long)(val))
|
#define atomic_fetch_sub_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), -(long)(val))
|
||||||
#define atomic_fetch_sub_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), -(__int64)(val))
|
#define atomic_fetch_sub_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), -(__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_sub_ptr atomic_fetch_sub_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_and_fetch_8(char volatile* ptr, char val);
|
|
||||||
short interlocked_and_fetch_16(short volatile* ptr, short val);
|
|
||||||
#endif
|
|
||||||
long interlocked_and_fetch_32(long volatile* ptr, long val);
|
|
||||||
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
|
#define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
|
#define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
|
||||||
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_and_fetch_ptr atomic_and_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_and_fetch_ptr atomic_and_fetch_32
|
|
||||||
#endif
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
|
#define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
|
#define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
|
||||||
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
|
||||||
|
|
||||||
#ifdef _M_IX86
|
|
||||||
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
#define atomic_fetch_and_64(ptr, val) interlocked_fetch_and_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_fetch_and_64(ptr, val) interlocked_fetch_and_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#else
|
|
||||||
#define atomic_fetch_and_64(ptr, val) _InterlockedAnd64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_and_ptr atomic_fetch_and_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_and_ptr atomic_fetch_and_32
|
|
||||||
#endif
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_or_fetch_8(char volatile* ptr, char val);
|
|
||||||
short interlocked_or_fetch_16(short volatile* ptr, short val);
|
|
||||||
#endif
|
|
||||||
long interlocked_or_fetch_32(long volatile* ptr, long val);
|
|
||||||
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
|
#define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
|
#define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
|
||||||
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_or_fetch_ptr atomic_or_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_or_fetch_ptr atomic_or_fetch_32
|
|
||||||
#endif
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
|
#define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
|
#define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
|
||||||
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
|
||||||
|
|
||||||
#ifdef _M_IX86
|
|
||||||
__int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
#define atomic_fetch_or_64(ptr, val) interlocked_fetch_or_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_fetch_or_64(ptr, val) interlocked_fetch_or_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#else
|
|
||||||
#define atomic_fetch_or_64(ptr, val) _InterlockedOr64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_or_ptr atomic_fetch_or_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_or_ptr atomic_fetch_or_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_xor_fetch_8(char volatile* ptr, char val);
|
|
||||||
short interlocked_xor_fetch_16(short volatile* ptr, short val);
|
|
||||||
#endif
|
|
||||||
long interlocked_xor_fetch_32(long volatile* ptr, long val);
|
|
||||||
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
|
#define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
|
#define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
|
||||||
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_xor_fetch_ptr atomic_xor_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
|
#define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
|
#define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
|
||||||
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
|
||||||
|
|
||||||
#ifdef _M_IX86
|
|
||||||
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
#define atomic_fetch_xor_64(ptr, val) interlocked_fetch_xor_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_fetch_xor_64(ptr, val) interlocked_fetch_xor_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#else
|
|
||||||
#define atomic_fetch_xor_64(ptr, val) _InterlockedXor64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
#define atomic_add_fetch_ptr atomic_add_fetch_64
|
||||||
|
#define atomic_fetch_add_ptr atomic_fetch_add_64
|
||||||
|
#define atomic_sub_fetch_ptr atomic_sub_fetch_64
|
||||||
|
#define atomic_fetch_sub_ptr atomic_fetch_sub_64
|
||||||
|
#define atomic_and_fetch_ptr atomic_and_fetch_64
|
||||||
|
#define atomic_fetch_and_ptr atomic_fetch_and_64
|
||||||
|
#define atomic_or_fetch_ptr atomic_or_fetch_64
|
||||||
|
#define atomic_fetch_or_ptr atomic_fetch_or_64
|
||||||
|
#define atomic_xor_fetch_ptr atomic_xor_fetch_64
|
||||||
#define atomic_fetch_xor_ptr atomic_fetch_xor_64
|
#define atomic_fetch_xor_ptr atomic_fetch_xor_64
|
||||||
#else
|
#else
|
||||||
|
#define atomic_add_fetch_ptr atomic_add_fetch_32
|
||||||
|
#define atomic_fetch_add_ptr atomic_fetch_add_32
|
||||||
|
#define atomic_sub_fetch_ptr atomic_sub_fetch_32
|
||||||
|
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
|
||||||
|
#define atomic_and_fetch_ptr atomic_and_fetch_32
|
||||||
|
#define atomic_fetch_and_ptr atomic_fetch_and_32
|
||||||
|
#define atomic_or_fetch_ptr atomic_or_fetch_32
|
||||||
|
#define atomic_fetch_or_ptr atomic_fetch_or_32
|
||||||
|
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
|
||||||
#define atomic_fetch_xor_ptr atomic_fetch_xor_32
|
#define atomic_fetch_xor_ptr atomic_fetch_xor_32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,15 +43,13 @@ long interlocked_add_fetch_32(long volatile* ptr, long val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_add_fetch_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_add_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
#ifdef _WIN64
|
//#ifdef _WIN64
|
||||||
return _InterlockedExchangeAdd64(ptr, val) + val;
|
return _InterlockedExchangeAdd64(ptr, val) + val;
|
||||||
#else
|
//#else
|
||||||
return _InterlockedExchangeAdd(ptr, val) + val;
|
// return _InterlockedExchangeAdd(ptr, val) + val;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// and
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
||||||
return _InterlockedAnd8(ptr, val) & val;
|
return _InterlockedAnd8(ptr, val) & val;
|
||||||
}
|
}
|
||||||
|
@ -59,41 +57,37 @@ char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
||||||
short interlocked_and_fetch_16(short volatile* ptr, short val) {
|
short interlocked_and_fetch_16(short volatile* ptr, short val) {
|
||||||
return _InterlockedAnd16(ptr, val) & val;
|
return _InterlockedAnd16(ptr, val) & val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
long interlocked_and_fetch_32(long volatile* ptr, long val) {
|
long interlocked_and_fetch_32(long volatile* ptr, long val) {
|
||||||
return _InterlockedAnd(ptr, val) & val;
|
return _InterlockedAnd(ptr, val) & val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
#ifndef _M_IX86
|
#ifndef _M_IX86
|
||||||
|
|
||||||
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
return _InterlockedAnd64(ptr, val) & val;
|
return _InterlockedAnd64(ptr, val) & val;
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
__int64 old, res;
|
__int64 old, res;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old & val;
|
res = old & val;
|
||||||
} while (_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old;
|
__int64 old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while (_InterlockedCompareExchange64(ptr, old & val, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, old & val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
|
#else
|
||||||
|
return _InterlockedAnd64((__int64 volatile*)(ptr), (__int64)(val));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// or
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
||||||
return _InterlockedOr8(ptr, val) | val;
|
return _InterlockedOr8(ptr, val) | val;
|
||||||
}
|
}
|
||||||
|
@ -101,40 +95,36 @@ char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
||||||
short interlocked_or_fetch_16(short volatile* ptr, short val) {
|
short interlocked_or_fetch_16(short volatile* ptr, short val) {
|
||||||
return _InterlockedOr16(ptr, val) | val;
|
return _InterlockedOr16(ptr, val) | val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
long interlocked_or_fetch_32(long volatile* ptr, long val) {
|
long interlocked_or_fetch_32(long volatile* ptr, long val) {
|
||||||
return _InterlockedOr(ptr, val) | val;
|
return _InterlockedOr(ptr, val) | val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _M_IX86
|
|
||||||
|
|
||||||
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
return _InterlockedOr64(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old, res;
|
__int64 old, res;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old | val;
|
res = old | val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
|
#else
|
||||||
|
return _InterlockedOr64(ptr, val) & val;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old;
|
__int64 old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while(_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
} while(_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
|
#else
|
||||||
|
return _InterlockedOr64((__int64 volatile*)(ptr), (__int64)(val));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// xor
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
||||||
return _InterlockedXor8(ptr, val) ^ val;
|
return _InterlockedXor8(ptr, val) ^ val;
|
||||||
}
|
}
|
||||||
|
@ -142,35 +132,33 @@ char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
||||||
short interlocked_xor_fetch_16(short volatile* ptr, short val) {
|
short interlocked_xor_fetch_16(short volatile* ptr, short val) {
|
||||||
return _InterlockedXor16(ptr, val) ^ val;
|
return _InterlockedXor16(ptr, val) ^ val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
long interlocked_xor_fetch_32(long volatile* ptr, long val) {
|
long interlocked_xor_fetch_32(long volatile* ptr, long val) {
|
||||||
return _InterlockedXor(ptr, val) ^ val;
|
return _InterlockedXor(ptr, val) ^ val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _M_IX86
|
|
||||||
|
|
||||||
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
return _InterlockedXor64(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old, res;
|
__int64 old, res;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old ^ val;
|
res = old ^ val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
|
#else
|
||||||
|
return _InterlockedXor64(ptr, val) ^ val;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old;
|
__int64 old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while (_InterlockedCompareExchange64(ptr, old ^ val, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, old ^ val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
|
#else
|
||||||
|
return _InterlockedXor64((__int64 volatile*)(ptr), (__int64)(val));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
|
||||||
|
|
||||||
bool taosGetProcMemory(float *memoryUsedMB) {
|
bool taosGetProcMemory(float *memoryUsedMB) {
|
||||||
unsigned bytes_used = 0;
|
unsigned bytes_used = 0;
|
||||||
|
#if 0
|
||||||
#if defined(_WIN32) && defined(_MSC_VER)
|
#if defined(_WIN32) && defined(_MSC_VER)
|
||||||
PROCESS_MEMORY_COUNTERS pmc;
|
PROCESS_MEMORY_COUNTERS pmc;
|
||||||
HANDLE cur_proc = GetCurrentProcess();
|
HANDLE cur_proc = GetCurrentProcess();
|
||||||
|
@ -161,6 +162,7 @@ bool taosGetProcMemory(float *memoryUsedMB) {
|
||||||
if (GetProcessMemoryInfo(cur_proc, &pmc, sizeof(pmc))) {
|
if (GetProcessMemoryInfo(cur_proc, &pmc, sizeof(pmc))) {
|
||||||
bytes_used = (unsigned)(pmc.WorkingSetSize + pmc.PagefileUsage);
|
bytes_used = (unsigned)(pmc.WorkingSetSize + pmc.PagefileUsage);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*memoryUsedMB = (float)bytes_used / 1024 / 1024;
|
*memoryUsedMB = (float)bytes_used / 1024 / 1024;
|
||||||
|
|
|
@ -410,7 +410,7 @@ static SWindowResult *doSetTimeWindowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SWin
|
||||||
newCap = (int64_t)(pWindowResInfo->capacity * 1.5);
|
newCap = (int64_t)(pWindowResInfo->capacity * 1.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *t = realloc(pWindowResInfo->pResult, newCap * sizeof(SWindowResult));
|
char *t = realloc(pWindowResInfo->pResult, (size_t)(newCap * sizeof(SWindowResult)));
|
||||||
pRuntimeEnv->summary.internalSupSize += (newCap - pWindowResInfo->capacity) * sizeof(SWindowResult);
|
pRuntimeEnv->summary.internalSupSize += (newCap - pWindowResInfo->capacity) * sizeof(SWindowResult);
|
||||||
|
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
|
@ -2257,7 +2257,7 @@ static void ensureOutputBuffer(SQueryRuntimeEnv* pRuntimeEnv, SDataBlockInfo* pB
|
||||||
if (tmp == NULL) { // todo handle the oom
|
if (tmp == NULL) { // todo handle the oom
|
||||||
assert(0);
|
assert(0);
|
||||||
} else {
|
} else {
|
||||||
memset(tmp + sizeof(tFilePage) + bytes * pRec->rows, 0, (newSize - pRec->rows) * bytes);
|
memset(tmp + sizeof(tFilePage) + bytes * pRec->rows, 0, (size_t)((newSize - pRec->rows) * bytes));
|
||||||
pQuery->sdata[i] = (tFilePage *)tmp;
|
pQuery->sdata[i] = (tFilePage *)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2725,7 +2725,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
|
||||||
for (int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
for (int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
||||||
int32_t bytes = pRuntimeEnv->pCtx[i].outputBytes;
|
int32_t bytes = pRuntimeEnv->pCtx[i].outputBytes;
|
||||||
char * pDest = pQuery->sdata[i]->data;
|
char * pDest = pQuery->sdata[i]->data;
|
||||||
memcpy(pDest + offset * bytes, pData->data + pRuntimeEnv->offset[i] * pData->num, bytes * pData->num);
|
memcpy(pDest + offset * bytes, pData->data + pRuntimeEnv->offset[i] * pData->num, (size_t)(bytes * pData->num));
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += (int32_t)pData->num;
|
offset += (int32_t)pData->num;
|
||||||
|
@ -2946,7 +2946,7 @@ int32_t flushFromResultBuf(SQInfo *pQInfo) {
|
||||||
buf->num = r;
|
buf->num = r;
|
||||||
|
|
||||||
memcpy(buf->data + pRuntimeEnv->offset[i] * buf->num, ((char *)pQuery->sdata[i]->data) + offset * bytes,
|
memcpy(buf->data + pRuntimeEnv->offset[i] * buf->num, ((char *)pQuery->sdata[i]->data) + offset * bytes,
|
||||||
buf->num * bytes);
|
(size_t)(buf->num * bytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += r;
|
offset += r;
|
||||||
|
@ -3119,7 +3119,7 @@ void resetCtxOutputBuf(SQueryRuntimeEnv *pRuntimeEnv) {
|
||||||
pCtx->ptsOutputBuf = pRuntimeEnv->pCtx[0].aOutputBuf;
|
pCtx->ptsOutputBuf = pRuntimeEnv->pCtx[0].aOutputBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(pQuery->sdata[i]->data, 0, (size_t)pQuery->pSelectExpr[i].bytes * pQuery->rec.capacity);
|
memset(pQuery->sdata[i]->data, 0, (size_t)(pQuery->pSelectExpr[i].bytes * pQuery->rec.capacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
initCtxOutputBuf(pRuntimeEnv);
|
initCtxOutputBuf(pRuntimeEnv);
|
||||||
|
@ -3198,7 +3198,7 @@ void skipResults(SQueryRuntimeEnv *pRuntimeEnv) {
|
||||||
int32_t functionId = pQuery->pSelectExpr[i].base.functionId;
|
int32_t functionId = pQuery->pSelectExpr[i].base.functionId;
|
||||||
int32_t bytes = pRuntimeEnv->pCtx[i].outputBytes;
|
int32_t bytes = pRuntimeEnv->pCtx[i].outputBytes;
|
||||||
|
|
||||||
memmove(pQuery->sdata[i]->data, (char*) pQuery->sdata[i]->data + bytes * numOfSkip, pQuery->rec.rows * bytes);
|
memmove(pQuery->sdata[i]->data, (char*)pQuery->sdata[i]->data + bytes * numOfSkip, (size_t)(pQuery->rec.rows * bytes));
|
||||||
pRuntimeEnv->pCtx[i].aOutputBuf = ((char*) pQuery->sdata[i]->data) + pQuery->rec.rows * bytes;
|
pRuntimeEnv->pCtx[i].aOutputBuf = ((char*) pQuery->sdata[i]->data) + pQuery->rec.rows * bytes;
|
||||||
|
|
||||||
if (functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) {
|
if (functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) {
|
||||||
|
@ -5384,8 +5384,8 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
|
||||||
if (pColFilter->filterstr) {
|
if (pColFilter->filterstr) {
|
||||||
pColFilter->len = htobe64(pFilterMsg->len);
|
pColFilter->len = htobe64(pFilterMsg->len);
|
||||||
|
|
||||||
pColFilter->pz = (int64_t) calloc(1, pColFilter->len + 1 * TSDB_NCHAR_SIZE); // note: null-terminator
|
pColFilter->pz = (int64_t)calloc(1, (size_t)(pColFilter->len + 1 * TSDB_NCHAR_SIZE)); // note: null-terminator
|
||||||
memcpy((void *)pColFilter->pz, pMsg, pColFilter->len);
|
memcpy((void *)pColFilter->pz, pMsg, (size_t)pColFilter->len);
|
||||||
pMsg += (pColFilter->len + 1);
|
pMsg += (pColFilter->len + 1);
|
||||||
} else {
|
} else {
|
||||||
pColFilter->lowerBndi = htobe64(pFilterMsg->lowerBndi);
|
pColFilter->lowerBndi = htobe64(pFilterMsg->lowerBndi);
|
||||||
|
@ -5889,7 +5889,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
|
||||||
assert(pExprs[col].interBytes >= pExprs[col].bytes);
|
assert(pExprs[col].interBytes >= pExprs[col].bytes);
|
||||||
|
|
||||||
// allocate additional memory for interResults that are usually larger then final results
|
// allocate additional memory for interResults that are usually larger then final results
|
||||||
size_t size = (pQuery->rec.capacity + 1) * pExprs[col].bytes + pExprs[col].interBytes + sizeof(tFilePage);
|
size_t size = (size_t)((pQuery->rec.capacity + 1) * pExprs[col].bytes + pExprs[col].interBytes + sizeof(tFilePage));
|
||||||
pQuery->sdata[col] = (tFilePage *)calloc(1, size);
|
pQuery->sdata[col] = (tFilePage *)calloc(1, size);
|
||||||
if (pQuery->sdata[col] == NULL) {
|
if (pQuery->sdata[col] == NULL) {
|
||||||
goto _cleanup;
|
goto _cleanup;
|
||||||
|
@ -6162,7 +6162,7 @@ static size_t getResultSize(SQInfo *pQInfo, int64_t *numOfRows) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return pQuery->rowSize * (*numOfRows);
|
return (size_t)(pQuery->rowSize * (*numOfRows));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -990,7 +990,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
|
||||||
SSchemaEx* pSchemaEx = &pModel->pFields[i];
|
SSchemaEx* pSchemaEx = &pModel->pFields[i];
|
||||||
memmove(inputBuffer->data + pSchemaEx->offset * inputBuffer->num,
|
memmove(inputBuffer->data + pSchemaEx->offset * inputBuffer->num,
|
||||||
inputBuffer->data + pSchemaEx->offset * maxElemsCapacity,
|
inputBuffer->data + pSchemaEx->offset * maxElemsCapacity,
|
||||||
pSchemaEx->field.bytes * inputBuffer->num);
|
(size_t)(pSchemaEx->field.bytes * inputBuffer->num));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, tFilePage* pInpu
|
||||||
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
||||||
|
|
||||||
char* data = pInput->data + pCol->col.offset * pInput->num;
|
char* data = pInput->data + pCol->col.offset * pInput->num;
|
||||||
memcpy(pFillInfo->pData[i], data, pInput->num * pCol->col.bytes);
|
memcpy(pFillInfo->pData[i], data, (size_t)(pInput->num * pCol->col.bytes));
|
||||||
|
|
||||||
if (pCol->flag == TSDB_COL_TAG) { // copy the tag value to tag value buffer
|
if (pCol->flag == TSDB_COL_TAG) { // copy the tag value to tag value buffer
|
||||||
for (int32_t j = 0; j < pFillInfo->numOfTags; ++j) {
|
for (int32_t j = 0; j < pFillInfo->numOfTags; ++j) {
|
||||||
|
|
|
@ -381,7 +381,7 @@ size_t getNumOfRowsPerPage(const SDiskbasedResultBuf* pResultBuf) { return pResu
|
||||||
|
|
||||||
size_t getNumOfResultBufGroupId(const SDiskbasedResultBuf* pResultBuf) { return taosHashGetSize(pResultBuf->groupSet); }
|
size_t getNumOfResultBufGroupId(const SDiskbasedResultBuf* pResultBuf) { return taosHashGetSize(pResultBuf->groupSet); }
|
||||||
|
|
||||||
size_t getResBufSize(const SDiskbasedResultBuf* pResultBuf) { return pResultBuf->totalBufSize; }
|
size_t getResBufSize(const SDiskbasedResultBuf* pResultBuf) { return (size_t)pResultBuf->totalBufSize; }
|
||||||
|
|
||||||
SIDList getDataBufPagesIdList(SDiskbasedResultBuf* pResultBuf, int32_t groupId) {
|
SIDList getDataBufPagesIdList(SDiskbasedResultBuf* pResultBuf, int32_t groupId) {
|
||||||
assert(pResultBuf != NULL);
|
assert(pResultBuf != NULL);
|
||||||
|
|
|
@ -908,7 +908,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
|
||||||
|
|
||||||
// Add the sub-block
|
// Add the sub-block
|
||||||
if (pSCompBlock->numOfSubBlocks > 1) {
|
if (pSCompBlock->numOfSubBlocks > 1) {
|
||||||
size_t tsize = pIdx->len - (pSCompBlock->offset + pSCompBlock->len);
|
size_t tsize = (size_t)(pIdx->len - (pSCompBlock->offset + pSCompBlock->len));
|
||||||
if (tsize > 0) {
|
if (tsize > 0) {
|
||||||
memmove((void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len + sizeof(SCompBlock)),
|
memmove((void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len + sizeof(SCompBlock)),
|
||||||
(void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len), tsize);
|
(void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len), tsize);
|
||||||
|
@ -988,7 +988,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
|
||||||
|
|
||||||
// Delete the sub blocks it has
|
// Delete the sub blocks it has
|
||||||
if (pSCompBlock->numOfSubBlocks > 1) {
|
if (pSCompBlock->numOfSubBlocks > 1) {
|
||||||
size_t tsize = pIdx->len - (pSCompBlock->offset + pSCompBlock->len);
|
size_t tsize = (size_t)(pIdx->len - (pSCompBlock->offset + pSCompBlock->len));
|
||||||
if (tsize > 0) {
|
if (tsize > 0) {
|
||||||
memmove(POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset),
|
memmove(POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset),
|
||||||
POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset + pSCompBlock->len), tsize);
|
POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset + pSCompBlock->len), tsize);
|
||||||
|
|
|
@ -355,9 +355,9 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
|
||||||
uint64_t size = 0;
|
uint64_t size = 0;
|
||||||
|
|
||||||
buf = taosDecodeVariantU64(buf, &size);
|
buf = taosDecodeVariantU64(buf, &size);
|
||||||
*value = (char *)malloc(size + 1);
|
*value = (char *)malloc((size_t)size + 1);
|
||||||
if (*value == NULL) return NULL;
|
if (*value == NULL) return NULL;
|
||||||
memcpy(*value, buf, size);
|
memcpy(*value, buf, (size_t)size);
|
||||||
|
|
||||||
(*value)[size] = '\0';
|
(*value)[size] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -575,7 +575,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = malloc(maxBufSize);
|
buf = malloc((size_t)maxBufSize);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
uError("failed to allocate %" PRId64 " bytes in KV store %s", maxBufSize, pStore->fname);
|
uError("failed to allocate %" PRId64 " bytes in KV store %s", maxBufSize, pStore->fname);
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
@ -598,7 +598,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosTRead(pStore->fd, buf, pRecord->size) < pRecord->size) {
|
if (taosTRead(pStore->fd, buf, (size_t)pRecord->size) < pRecord->size) {
|
||||||
uError("failed to read %" PRId64 " bytes from file %s since %s, offset %" PRId64, pRecord->size, pStore->fname,
|
uError("failed to read %" PRId64 " bytes from file %s since %s, offset %" PRId64, pRecord->size, pStore->fname,
|
||||||
strerror(errno), pRecord->offset);
|
strerror(errno), pRecord->offset);
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
|
Loading…
Reference in New Issue