diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 9ab78f3c9603011296c7ef450ba0d792dbc19043..fbeb212218bb4f8c708d864aabaf64e59ba14bf6 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -20,7 +20,7 @@ extern "C" { #endif -#include "encode.h" +#include "tencode.h" #include "taosdef.h" #include "taoserror.h" #include "tarray.h" diff --git a/include/util/encode.h b/include/util/tencode.h similarity index 97% rename from include/util/encode.h rename to include/util/tencode.h index 7135a98f40b029e0d108e88297c75701218873ac..aeb4582df55e460034905aa6688206a376150feb 100644 --- a/include/util/encode.h +++ b/include/util/tencode.h @@ -16,8 +16,8 @@ #ifndef _TD_UTIL_ENCODE_H_ #define _TD_UTIL_ENCODE_H_ -#include "tfreelist.h" #include "tcoding.h" +#include "tfreelist.h" #include "tmacro.h" #ifdef __cplusplus @@ -71,11 +71,11 @@ typedef struct { TD_SLIST(SCoderNode) stack; } SCoder; -#define TD_CODER_POS(CODER) ((CODER)->pos) -#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos) -#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE)) +#define TD_CODER_POS(CODER) ((CODER)->pos) +#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos) +#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE)) #define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE)) -#define TCODER_MALLOC(SIZE, CODER) TFL_MALLOC(SIZE, &((CODER)->fl)) +#define TCODER_MALLOC(SIZE, CODER) TFL_MALLOC(SIZE, &((CODER)->fl)) void tCoderInit(SCoder* pCoder, td_endian_t endian, uint8_t* data, int32_t size, td_coder_t type); void tCoderClear(SCoder* pCoder); diff --git a/include/util/texception.h b/include/util/texception.h index 4bf7d7593b912228e71e582734df28ae7182e5ab..7c169a3eaa24a2ceae77ff60e6bf321acf880065 100644 --- a/include/util/texception.h +++ b/include/util/texception.h @@ -31,21 +31,21 @@ typedef struct SCleanupAction { uint16_t reserved; void* func; union { - void* Ptr; - bool Bool; - char Char; - int8_t Int8; - uint8_t Uint8; - int16_t Int16; - uint16_t Uint16; - int Int; - unsigned int Uint; - int32_t Int32; - uint32_t Uint32; - int64_t Int64; - uint64_t Uint64; - float Float; - double Double; + void* Ptr; + bool Bool; + char Char; + int8_t Int8; + uint8_t Uint8; + int16_t Int16; + uint16_t Uint16; + int32_t Int; + uint32_t Uint; + int32_t Int32; + uint32_t Uint32; + int64_t Int64; + uint64_t Uint64; + float Float; + double Double; } arg1, arg2; } SCleanupAction; @@ -67,7 +67,7 @@ typedef struct SExceptionNode { void cleanupPush_void_ptr_ptr(bool failOnly, void* func, void* arg1, void* arg2); void cleanupPush_void_ptr_bool(bool failOnly, void* func, void* arg1, bool arg2); void cleanupPush_void_ptr(bool failOnly, void* func, void* arg); -void cleanupPush_int_int(bool failOnly, void* func, int arg); +void cleanupPush_int_int(bool failOnly, void* func, int32_t arg); void cleanupPush_void(bool failOnly, void* func); void cleanupPush_int_ptr(bool failOnly, void* func, void* arg); @@ -81,11 +81,11 @@ bool cleanupExceedLimit(); #define CLEANUP_PUSH_VOID_PTR_BOOL(failOnly, func, arg1, arg2) \ cleanupPush_void_ptr_bool((failOnly), (void*)(func), (void*)(arg1), (bool)(arg2)) #define CLEANUP_PUSH_VOID_PTR(failOnly, func, arg) cleanupPush_void_ptr((failOnly), (void*)(func), (void*)(arg)) -#define CLEANUP_PUSH_INT_INT(failOnly, func, arg) cleanupPush_void_ptr((failOnly), (void*)(func), (int)(arg)) +#define CLEANUP_PUSH_INT_INT(failOnly, func, arg) cleanupPush_void_ptr((failOnly), (void*)(func), (int32_t)(arg)) #define CLEANUP_PUSH_VOID(failOnly, func) cleanupPush_void((failOnly), (void*)(func)) #define CLEANUP_PUSH_INT_PTR(failOnly, func, arg) cleanupPush_int_ptr((failOnly), (void*)(func), (void*)(arg)) #define CLEANUP_PUSH_FREE(failOnly, arg) cleanupPush_void_ptr((failOnly), free, (void*)(arg)) -#define CLEANUP_PUSH_CLOSE(failOnly, arg) cleanupPush_int_int((failOnly), close, (int)(arg)) +#define CLEANUP_PUSH_CLOSE(failOnly, arg) cleanupPush_int_int((failOnly), close, (int32_t)(arg)) #define CLEANUP_PUSH_FCLOSE(failOnly, arg) cleanupPush_int_ptr((failOnly), fclose, (void*)(arg)) #define CLEANUP_GET_ANCHOR() cleanupGetActionCount() @@ -106,7 +106,7 @@ void exceptionThrow(int32_t code); exceptionNode.maxCleanupAction = (maxCleanupActions) > 0 ? (maxCleanupActions) : 1; \ exceptionNode.cleanupActions = cleanupActions; \ exceptionPushNode(&exceptionNode); \ - int caughtException = setjmp(exceptionNode.jb); \ + int32_t caughtException = setjmp(exceptionNode.jb); \ if (caughtException == 0) #define CATCH(code) \ diff --git a/source/util/src/encode.c b/source/util/src/tencode.c similarity index 99% rename from source/util/src/encode.c rename to source/util/src/tencode.c index 758d3f442db0007ea60317827d582d50f60f8d75..adcce58c89bd1c9f7e40506cbc0dc3ba3dc1337b 100644 --- a/source/util/src/encode.c +++ b/source/util/src/tencode.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include "encode.h" +#include "tencode.h" #if __STDC_VERSION__ >= 201112L static_assert(sizeof(float) == sizeof(uint32_t), "sizeof(float) must equal to sizeof(uint32_t)"); diff --git a/source/util/test/encodeTest.cpp b/source/util/test/encodeTest.cpp index 1b13c102a5a14103f51ceaf337d346723fd6f6f0..b11879064d5e211cd497bc86f851b0c847d55959 100644 --- a/source/util/test/encodeTest.cpp +++ b/source/util/test/encodeTest.cpp @@ -2,7 +2,7 @@ #include "gtest/gtest.h" -#include "encode.h" +#include "tencode.h" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshift-count-overflow"