From e87eef431434048db52b45e1486100eb02da2fea Mon Sep 17 00:00:00 2001 From: sancar Date: Tue, 19 Jan 2016 16:40:55 +0200 Subject: [PATCH] fixes compile problems due to usage of stdint MACROS --- CMakeLists.txt | 4 +-- .../util/LittleEndianBufferWrapper.h | 25 ++++++++----------- .../client/connection/ConnectionManager.cpp | 2 +- .../containers/LitlleEndianBufferTest.cpp | 2 +- hazelcast/test/util/BitsTest.cpp | 2 +- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e314544260..923daf5377 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,8 +100,8 @@ ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") message(STATUS "LINUX ENVIRONMENT DETECTED") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall -Werror -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS ${HZ_BIT_FLAG} ${HZ_CODE_COVERAGE_COMPILE_FLAGS} ${HZ_VALGRIND_COMPILE_FLAGS}") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS ${HZ_BIT_FLAG} ${HZ_CODE_COVERAGE_COMPILE_FLAGS} ${HZ_VALGRIND_COMPILE_FLAGS}") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall -Werror ${HZ_BIT_FLAG} ${HZ_CODE_COVERAGE_COMPILE_FLAGS} ${HZ_VALGRIND_COMPILE_FLAGS}") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall ${HZ_BIT_FLAG} ${HZ_CODE_COVERAGE_COMPILE_FLAGS} ${HZ_VALGRIND_COMPILE_FLAGS}") link_libraries(${HZ_LIB_NAME} pthread rt ) diff --git a/hazelcast/include/hazelcast/util/LittleEndianBufferWrapper.h b/hazelcast/include/hazelcast/util/LittleEndianBufferWrapper.h index fc96abe861..1be61f471e 100644 --- a/hazelcast/include/hazelcast/util/LittleEndianBufferWrapper.h +++ b/hazelcast/include/hazelcast/util/LittleEndianBufferWrapper.h @@ -31,19 +31,16 @@ namespace hazelcast { class HAZELCAST_API LittleEndianBufferWrapper { public: enum TypeSizes { - INT8_SIZE = INT32_C(1), - UINT8_SIZE = INT32_C(1), - INT16_SIZE = INT32_C(2), - UINT16_SIZE = INT32_C(2), - INT32_SIZE = INT32_C(4), - UINT32_SIZE = INT32_C(4), - UINT64_SIZE = INT32_C(8), - INT64_SIZE = INT32_C(8) + INT8_SIZE = 1, + UINT8_SIZE = 1, + INT16_SIZE = 2, + UINT16_SIZE = 2, + INT32_SIZE = 4, + UINT32_SIZE = 4, + UINT64_SIZE = 8, + INT64_SIZE = 8 }; - #define BUFFER_TRUE UINT8_C(1) - #define BUFFER_FALSE UINT8_C(0) - inline void wrapForWrite(byte *buf, int32_t size, int32_t offset) { buffer = buf; capacity = size; @@ -78,7 +75,7 @@ namespace hazelcast { } inline bool getBoolean() { - return BUFFER_FALSE != getUint8(); + return 0 != getUint8(); } inline uint16_t getUint16() { @@ -155,9 +152,9 @@ namespace hazelcast { inline void set(bool value) { assert(checkWriteAvailable(UINT8_SIZE)); if (value) { - set((uint8_t)BUFFER_TRUE); + set((uint8_t)1); } else { - set((uint8_t)BUFFER_FALSE); + set((uint8_t)0); } } diff --git a/hazelcast/src/hazelcast/client/connection/ConnectionManager.cpp b/hazelcast/src/hazelcast/client/connection/ConnectionManager.cpp index 433bacf4fc..4468752210 100644 --- a/hazelcast/src/hazelcast/client/connection/ConnectionManager.cpp +++ b/hazelcast/src/hazelcast/client/connection/ConnectionManager.cpp @@ -46,7 +46,7 @@ namespace hazelcast { : clientContext(clientContext), inSelector(*this), outSelector(*this), inSelectorThread(NULL), outSelectorThread(NULL), live(true), heartBeater(clientContext), heartBeatThread(NULL), smartRouting(smartRouting), ownerConnectionFuture(clientContext), - callIdGenerator(UINT32_C(0)) { + callIdGenerator(0) { const byte protocol_bytes[3] = {'C', 'B', '2'}; PROTOCOL.insert(PROTOCOL.begin(), &protocol_bytes[0], &protocol_bytes[3]); } diff --git a/hazelcast/test/common/containers/LitlleEndianBufferTest.cpp b/hazelcast/test/common/containers/LitlleEndianBufferTest.cpp index cfa035ac3a..d3294f66cd 100644 --- a/hazelcast/test/common/containers/LitlleEndianBufferTest.cpp +++ b/hazelcast/test/common/containers/LitlleEndianBufferTest.cpp @@ -59,7 +59,7 @@ namespace hazelcast { #define LARGE_BUFFER_SIZE 20 #define START_BYTE_NUMBER 5 - uint64_t ONE = UINT64_C(1); + uint64_t ONE = 1; uint64_t oneByteFactor = ONE << 8; uint64_t twoBytesFactor = ONE << 16; uint64_t threeBytesFactor = ONE << 24; diff --git a/hazelcast/test/util/BitsTest.cpp b/hazelcast/test/util/BitsTest.cpp index 8cd67e3267..d34c5b1a19 100644 --- a/hazelcast/test/util/BitsTest.cpp +++ b/hazelcast/test/util/BitsTest.cpp @@ -56,7 +56,7 @@ namespace hazelcast { } void BitsTest::testLittleEndian() { - uint64_t ONE = UINT64_C(1); + uint64_t ONE = 1; uint64_t oneByteFactor = ONE << 8; uint64_t twoBytesFactor = ONE << 16; uint64_t threeBytesFactor = ONE << 24;