diff --git a/src/query/inc/qResultbuf.h b/src/query/inc/qResultbuf.h index 41fccd177dc7b384b199028a60b17ffafa061cfc..7df39c00fd4f9910096cc09f7e36f25eb7761492 100644 --- a/src/query/inc/qResultbuf.h +++ b/src/query/inc/qResultbuf.h @@ -90,9 +90,9 @@ SIDList getDataBufPagesIdList(SDiskbasedResultBuf* pResultBuf, int32_t groupId); //#define getResBufPage(buf, id) ((tFilePage*)((buf)->pBuf + (buf)->pageSize * (id))) static FORCE_INLINE tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) { if (id < pResultBuf->inMemPages) { - return pResultBuf->iBuf + id * pResultBuf->pageSize; + return (tFilePage*) ((char*) pResultBuf->iBuf + id * pResultBuf->pageSize); } else { - return pResultBuf->pBuf + (id - pResultBuf->inMemPages) * pResultBuf->pageSize; + return (tFilePage*) ((char*) pResultBuf->pBuf + (id - pResultBuf->inMemPages) * pResultBuf->pageSize); } } /** diff --git a/src/query/tests/resultBufferTest.cpp b/src/query/tests/resultBufferTest.cpp index f822deeb7351db64a59c4b4e7b493cdd951f4efc..63ed89ab9fe1de2222c6f5ea8ae05b331437f76d 100644 --- a/src/query/tests/resultBufferTest.cpp +++ b/src/query/tests/resultBufferTest.cpp @@ -10,7 +10,7 @@ namespace { // simple test void simpleTest() { SDiskbasedResultBuf* pResultBuf = NULL; - int32_t ret = createDiskbasedResultBuffer(&pResultBuf, 1000, 64, NULL); + int32_t ret = createDiskbasedResultBuffer(&pResultBuf, 1000, 64, 1024, 4, NULL); int32_t pageId = 0; int32_t groupId = 0; @@ -22,8 +22,7 @@ void simpleTest() { ASSERT_EQ(getResBufSize(pResultBuf), 1000*16384L); SIDList list = getDataBufPagesIdList(pResultBuf, groupId); - ASSERT_EQ(list.size, 1); - + ASSERT_EQ(taosArrayGetSize(list), 1); ASSERT_EQ(getNumOfResultBufGroupId(pResultBuf), 1); destroyResultBuf(pResultBuf, NULL); diff --git a/src/util/inc/tutil.h b/src/util/inc/tutil.h index f7c69e3973ad6fdefd4ef33f4a813221eedebe6d..34f35c380745172f5fc6a6d4aaf094cdf82c68ac 100644 --- a/src/util/inc/tutil.h +++ b/src/util/inc/tutil.h @@ -35,12 +35,12 @@ extern "C" { #define WCHAR wchar_t #define tfree(x) \ - { \ + do { \ if (x) { \ free((void *)(x)); \ x = 0; \ } \ - } + } while(0); #define tstrncpy(dst, src, size) \ do { \