From 99acec83c95dbb567d7785eb1b7e0b116d869f57 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 3 Aug 2015 20:27:46 -0300 Subject: [PATCH] Renamed some internal functions to avoid name conflicts when some third-party code is #included. --- src/common/int.h | 6 +++--- src/modules/image/magpie/KTXHandler.cpp | 6 +++--- src/modules/image/magpie/PKMHandler.cpp | 2 +- src/modules/image/magpie/PVRHandler.cpp | 22 +++++++++++----------- src/modules/math/Compressor.cpp | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/common/int.h b/src/common/int.h index 5b42c1d4b..8a665678c 100644 --- a/src/common/int.h +++ b/src/common/int.h @@ -45,12 +45,12 @@ typedef uint32_t uint32; typedef int64_t int64; typedef uint64_t uint64; -static inline uint16 swap16(uint16 x) +static inline uint16 swapuint16(uint16 x) { return (x >> 8) | (x << 8); } -static inline uint32 swap32(uint32 x) +static inline uint32 swapuint32(uint32 x) { return ((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | @@ -58,7 +58,7 @@ static inline uint32 swap32(uint32 x) ((x & 0xFF000000) >> 24); } -static inline uint64 swap64(uint64 x) +static inline uint64 swapuint64(uint64 x) { return ((x << 56) & 0xFF00000000000000ULL) | ((x << 40) & 0x00FF000000000000ULL) | ((x << 24) & 0x0000FF0000000000ULL) | ((x << 8) & 0x000000FF00000000ULL) | diff --git a/src/modules/image/magpie/KTXHandler.cpp b/src/modules/image/magpie/KTXHandler.cpp index 1530e7dd9..4b3f095ed 100644 --- a/src/modules/image/magpie/KTXHandler.cpp +++ b/src/modules/image/magpie/KTXHandler.cpp @@ -170,7 +170,7 @@ uint8 *KTXHandler::parse(filesystem::FileData *filedata, std::vector 1) diff --git a/src/modules/math/Compressor.cpp b/src/modules/math/Compressor.cpp index 48827c94e..2a15fba64 100644 --- a/src/modules/math/Compressor.cpp +++ b/src/modules/math/Compressor.cpp @@ -63,7 +63,7 @@ public: // Store the size of the uncompressed data as a header. #ifdef LOVE_BIG_ENDIAN // Make sure it's little-endian for storage. - *(uint32 *) compressedbytes = swap32((uint32) dataSize); + *(uint32 *) compressedbytes = swapuint32((uint32) dataSize); #else *(uint32 *) compressedbytes = (uint32) dataSize; #endif @@ -110,7 +110,7 @@ public: // Extract the original uncompressed size (stored in our custom header.) #ifdef LOVE_BIG_ENDIAN // Convert from stored little-endian to big-endian. - uint32 rawsize = swap32(*(uint32 *) data); + uint32 rawsize = swapuint32(*(uint32 *) data); #else uint32 rawsize = *(uint32 *) data; #endif