From eca3fbfa67540507ee0484f1aef647132ffd3501 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 14 Aug 2021 17:44:17 -0400 Subject: [PATCH 1/3] * [UUID] BugFix: Correct a memory mismanagement error in UUID programming due to the way xuuid_t is utilized. --- Engine/source/console/consoleTypes.cpp | 13 ++++++++----- Engine/source/core/util/uuid.cpp | 19 +------------------ Engine/source/core/util/uuid.h | 22 +++++++++++++++++++++- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Engine/source/console/consoleTypes.cpp b/Engine/source/console/consoleTypes.cpp index beaffe6c8..283cd0351 100644 --- a/Engine/source/console/consoleTypes.cpp +++ b/Engine/source/console/consoleTypes.cpp @@ -975,13 +975,16 @@ ConsoleSetType( TypePID ) else { Torque::UUID uuid; - if( !uuid.fromString( argv[ 0 ] ) ) - { + + if( !uuid.fromString( argv[ 0 ] ) ) + { Con::errorf( "Error parsing UUID in PID: '%s'", argv[ 0 ] ); *pid = NULL; - } - else - *pid = SimPersistID::findOrCreate( uuid ); + } + else + { + *pid = SimPersistID::findOrCreate(uuid); + } } } else diff --git a/Engine/source/core/util/uuid.cpp b/Engine/source/core/util/uuid.cpp index 795a5a7f2..e55325db7 100644 --- a/Engine/source/core/util/uuid.cpp +++ b/Engine/source/core/util/uuid.cpp @@ -68,32 +68,15 @@ #include #include "core/util/md5.h" +#include "core/util/uuid.h" #include "console/enginePrimitives.h" -#if defined (TORQUE_OS_MAC) && (defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64)) -typedef unsigned int unsigned32; -#else -typedef unsigned long unsigned32; -#endif -typedef unsigned short unsigned16; -typedef unsigned char unsigned8; - typedef struct { char nodeID[6]; } uuid_node_t; #undef xuuid_t -typedef struct _uuid_t -{ - unsigned32 time_low; - unsigned16 time_mid; - unsigned16 time_hi_and_version; - unsigned8 clock_seq_hi_and_reserved; - unsigned8 clock_seq_low; - unsigned8 node[6]; -} xuuid_t; - /* data type for UUID generator persistent state */ typedef struct { diff --git a/Engine/source/core/util/uuid.h b/Engine/source/core/util/uuid.h index e902c3002..20ff16d69 100644 --- a/Engine/source/core/util/uuid.h +++ b/Engine/source/core/util/uuid.h @@ -28,11 +28,31 @@ #endif #include "console/engineTypeInfo.h" +#if defined (TORQUE_OS_MAC) && (defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64)) +typedef unsigned int unsigned32; +#else +typedef unsigned long unsigned32; +#endif +typedef unsigned short unsigned16; +typedef unsigned char unsigned8; + +class xuuid_t +{ +public: + unsigned32 time_low; + unsigned16 time_mid; + unsigned16 time_hi_and_version; + unsigned8 clock_seq_hi_and_reserved; + unsigned8 clock_seq_low; + unsigned8 node[6]; +}; namespace Torque { + + /// A universally unique identifier. - class UUID + class UUID : public xuuid_t { friend class UUIDEngineExport; public: From 3f34c9020e7c300d8ccf7b6f9d5e67527ff7e321 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 14 Aug 2021 18:22:30 -0400 Subject: [PATCH 2/3] * [ParticleEmitter] BugFix: Make GCC happy by removing the inline specification on updateKeyData. --- Engine/source/T3D/fx/particleEmitter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/T3D/fx/particleEmitter.h b/Engine/source/T3D/fx/particleEmitter.h index 571dd2c8b..32bf5beca 100644 --- a/Engine/source/T3D/fx/particleEmitter.h +++ b/Engine/source/T3D/fx/particleEmitter.h @@ -278,7 +278,7 @@ class ParticleEmitter : public GameBase // code to expose the necessary members and methods. void update( U32 ms ); protected: - inline void updateKeyData( Particle *part ); + void updateKeyData( Particle *part ); private: From 3ecdf292d7ff60b65850d1c9596faabe510f5a6e Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Fri, 20 Aug 2021 22:53:45 -0400 Subject: [PATCH 3/3] * Adjustment: Remove some unnecessary ifdef logic in UUID headers. --- Engine/source/core/util/uuid.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Engine/source/core/util/uuid.h b/Engine/source/core/util/uuid.h index 20ff16d69..28cc984e8 100644 --- a/Engine/source/core/util/uuid.h +++ b/Engine/source/core/util/uuid.h @@ -28,11 +28,7 @@ #endif #include "console/engineTypeInfo.h" -#if defined (TORQUE_OS_MAC) && (defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64)) typedef unsigned int unsigned32; -#else -typedef unsigned long unsigned32; -#endif typedef unsigned short unsigned16; typedef unsigned char unsigned8;