From 9181ba649b84538a5d4a1b01204949be8b57632b Mon Sep 17 00:00:00 2001 From: Dinand Vanvelzen Date: Sat, 10 Aug 2024 07:53:36 -0700 Subject: [PATCH] Build fixes for some legacy 'tools' which had issues with the namespace of min/max defines --- common/include/gucef_types.h | 41 +++++++++++++---------- platform/gucefCORE/src/dvcppfileutils.cpp | 38 ++++++++++----------- platform/gucefKAITAI/CMakeLists.txt | 2 -- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/common/include/gucef_types.h b/common/include/gucef_types.h index b7d020085..60e86af08 100644 --- a/common/include/gucef_types.h +++ b/common/include/gucef_types.h @@ -116,27 +116,32 @@ typedef double Float64; /* 8 bytes, signed, decimal */ // // //-------------------------------------------------------------------------*/ +#ifdef __cplusplus + #define GUCEF_NS_FOR_BUILDINS ::GUCEF:: +#else + #define GUCEF_NS_FOR_BUILDINS +#endif /* * Maximum and minimal values for the build-in types */ -#define GUCEF_INT8MAX ( (Int8) 127 ) -#define GUCEF_INT8MIN ( (Int8) (-128) ) -#define GUCEF_UINT8MAX ( (UInt8) 256 ) -#define GUCEF_UINT8MIN ( (UInt8) 0 ) -#define GUCEF_INT16MAX ( (Int16) 32767 ) -#define GUCEF_INT16MIN ( (Int16) (-32767-1) ) -#define GUCEF_UINT16MAX ( (UInt16) 65535 ) -#define GUCEF_UINT16MIN ( (UInt16) 0 ) -#define GUCEF_INT32MAX ( (Int32) 2147483647 ) -#define GUCEF_INT32MIN ( (Int32) (-2147483647-1) ) -#define GUCEF_UINT32MAX ( (UInt32) 4294967295 ) -#define GUCEF_UINT32MIN ( (UInt32) 0 ) -#define GUCEF_INT64MIN ( (Int64) -9223372036854775808 ) -#define GUCEF_INT64MAX ( (Int64) 9223372036854775807 ) -#define GUCEF_UINT64MIN ( (UInt64) 0 ) -#define GUCEF_UINT64MAX ( (UInt64) 18446744073709551615 ) -#define GUCEF_FLOAT32MAX ( (Float32) (3.40282347E+38F) ) -#define GUCEF_FLOAT32MIN ( (Float32) (-3.40282347E+38F-1) ) +#define GUCEF_INT8MAX ( (GUCEF_NS_FOR_BUILDINS Int8) 127 ) +#define GUCEF_INT8MIN ( (GUCEF_NS_FOR_BUILDINS Int8) (-128) ) +#define GUCEF_UINT8MAX ( (GUCEF_NS_FOR_BUILDINS UInt8) 256 ) +#define GUCEF_UINT8MIN ( (GUCEF_NS_FOR_BUILDINS UInt8) 0 ) +#define GUCEF_INT16MAX ( (GUCEF_NS_FOR_BUILDINS Int16) 32767 ) +#define GUCEF_INT16MIN ( (GUCEF_NS_FOR_BUILDINS Int16) (-32767-1) ) +#define GUCEF_UINT16MAX ( (GUCEF_NS_FOR_BUILDINS UInt16) 65535 ) +#define GUCEF_UINT16MIN ( (GUCEF_NS_FOR_BUILDINS UInt16) 0 ) +#define GUCEF_INT32MAX ( (GUCEF_NS_FOR_BUILDINS Int32) 2147483647 ) +#define GUCEF_INT32MIN ( (GUCEF_NS_FOR_BUILDINS Int32) (-2147483647-1) ) +#define GUCEF_UINT32MAX ( (GUCEF_NS_FOR_BUILDINS UInt32) 4294967295 ) +#define GUCEF_UINT32MIN ( (GUCEF_NS_FOR_BUILDINS UInt32) 0 ) +#define GUCEF_INT64MIN ( (GUCEF_NS_FOR_BUILDINS Int64) -9223372036854775808 ) +#define GUCEF_INT64MAX ( (GUCEF_NS_FOR_BUILDINS Int64) 9223372036854775807 ) +#define GUCEF_UINT64MIN ( (GUCEF_NS_FOR_BUILDINS UInt64) 0 ) +#define GUCEF_UINT64MAX ( (GUCEF_NS_FOR_BUILDINS UInt64) 18446744073709551615 ) +#define GUCEF_FLOAT32MAX ( (GUCEF_NS_FOR_BUILDINS Float32) (3.40282347E+38F) ) +#define GUCEF_FLOAT32MIN ( (GUCEF_NS_FOR_BUILDINS Float32) (-3.40282347E+38F-1) ) /*--------------------------------------------------------------------------*/ diff --git a/platform/gucefCORE/src/dvcppfileutils.cpp b/platform/gucefCORE/src/dvcppfileutils.cpp index 3c32caf63..33245c637 100644 --- a/platform/gucefCORE/src/dvcppfileutils.cpp +++ b/platform/gucefCORE/src/dvcppfileutils.cpp @@ -940,20 +940,20 @@ GetAllFileSystemMountPointsForVolume( const CString& volumeId , // Structure used to store dir iteration data which is O/S dependent class CFileSystemIterator::CFileSystemIteratorOsData { - public: - + public: + bool isActive; // Flag indicating if the iterator is active #if ( GUCEF_PLATFORM == GUCEF_PLATFORM_MSWIN ) intptr_t find_handle; // Unique handle identifying the file or set of files that resulted from a findfirst with the filter provided - struct _wfinddata64_t find; // struct that stores entry data - - CFileSystemIteratorOsData( void ) - : isActive( false ) // we start with an inactive iterator. A call to FindFirst will activate it potentially - , find_handle( 0 ) - { - memset( &find, 0, sizeof find ); + struct _wfinddata64_t find; // struct that stores entry data + + CFileSystemIteratorOsData( void ) + : isActive( false ) // we start with an inactive iterator. A call to FindFirst will activate it potentially + , find_handle( 0 ) + { + memset( &find, 0, sizeof find ); } #elif ( ( GUCEF_PLATFORM == GUCEF_PLATFORM_LINUX ) || ( GUCEF_PLATFORM == GUCEF_PLATFORM_ANDROID ) ) @@ -961,15 +961,15 @@ class CFileSystemIterator::CFileSystemIteratorOsData DIR* dir; // Directory stream struct dirent* entry; // Pointer needed for functions to iterating directory entries. Stores entry name which is used to get stat struct stat statinfo; // Struct needed for determining info about an entry with stat(). - - CFileSystemIteratorOsData( void ) - : isActive( false ) - , dir( GUCEF_NULL ) - , entry( GUCEF_NULL ) - , statinfo() - { - memset( &statinfo, 0, sizeof statinfo ); - } + + CFileSystemIteratorOsData( void ) + : isActive( false ) + , dir( GUCEF_NULL ) + , entry( GUCEF_NULL ) + , statinfo() + { + memset( &statinfo, 0, sizeof statinfo ); + } #else @@ -995,7 +995,7 @@ CFileSystemIterator::~CFileSystemIterator() if ( GUCEF_NULL != m_osData ) { FindClose(); - GUCEF_DELETE m_osData; + GUCEF_DELETE m_osData; m_osData = GUCEF_NULL; } } diff --git a/platform/gucefKAITAI/CMakeLists.txt b/platform/gucefKAITAI/CMakeLists.txt index f48ee9e1b..c0facff52 100644 --- a/platform/gucefKAITAI/CMakeLists.txt +++ b/platform/gucefKAITAI/CMakeLists.txt @@ -20,7 +20,6 @@ set( HEADER_FILES includes/gucefKAITAI_CKaitaiSchemaEnumDefinition.h includes/gucefKAITAI_CKaitaiSchemaFieldDefinition.h includes/gucefKAITAI_CKaitaiSchemaRegistry.h - includes/gucefKAITAI_CKaitaiSerializer.h includes/gucefKAITAI_CModule.h includes/gucefKAITAI_ETypes.h includes/gucefKAITAI_config.h @@ -35,7 +34,6 @@ set( SOURCE_FILES src/gucefKAITAI_CKaitaiSchemaEnumDefinition.cpp src/gucefKAITAI_CKaitaiSchemaFieldDefinition.cpp src/gucefKAITAI_CKaitaiSchemaRegistry.cpp - src/gucefKAITAI_CKaitaiSerializer.cpp src/gucefKAITAI_CModule.cpp )