From 83c25c87fa8d463d0e55de1ce6c309458c62bfbe Mon Sep 17 00:00:00 2001 From: T-rvw <429601557@qq.com> Date: Mon, 18 Dec 2023 15:15:58 +0800 Subject: [PATCH] fix string heap error --- .../ProgressiveMesh/GenericToPMToFbx/Main.cpp | 2 +- public/Scene/APIMacros.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/Prototype/ProgressiveMesh/GenericToPMToFbx/Main.cpp b/examples/Prototype/ProgressiveMesh/GenericToPMToFbx/Main.cpp index bf285111..397d1363 100644 --- a/examples/Prototype/ProgressiveMesh/GenericToPMToFbx/Main.cpp +++ b/examples/Prototype/ProgressiveMesh/GenericToPMToFbx/Main.cpp @@ -76,7 +76,7 @@ int main(int argc, char** argv) } auto lodMesh = pm.GenerateLodMesh(0.1f, 2000, &mesh); - lodMesh.SetName(std::format("{}_reduced", mesh.GetName())); + lodMesh.SetName(std::format("{}_reduced", mesh.GetName()).c_str()); lodMesh.SetID(pSceneDatabase->GetMeshCount()); pSceneDatabase->AddMesh(cd::MoveTemp(lodMesh)); } diff --git a/public/Scene/APIMacros.h b/public/Scene/APIMacros.h index 886ef4e5..ed6c4373 100644 --- a/public/Scene/APIMacros.h +++ b/public/Scene/APIMacros.h @@ -55,11 +55,11 @@ public: \ // String Type //////////////////////////////////////////////////////////////////////////////////////// #define EXPORT_STRING_TYPE_APIS(Class, Type) \ - void Set##Type(Class##TypeTraits::Type id); \ - const char* Get##Type() const; + void Set##Type(const char* pValue); \ + const char* Get##Type() const; \ #define PIMPL_STRING_TYPE_APIS(Class, Type) \ - void Class::Set##Type(Class##TypeTraits::Type value) { return m_p##Class##Impl->Set##Type(cd::MoveTemp(value)); } \ + void Class::Set##Type(const char* pValue) { return m_p##Class##Impl->Set##Type(pValue); } \ const char* Class::Get##Type() const { return m_p##Class##Impl->Get##Type().c_str(); } \ #define IMPLEMENT_STRING_TYPE_APIS(Class, Type) \ @@ -75,9 +75,9 @@ public: \ // Simple Type : bool, char, int, uint, float, double, ... in small size //////////////////////////////////////////////////////////////////////////////////////// #define EXPORT_SIMPLE_TYPE_APIS(Class, Type) \ - void Set##Type(Class##TypeTraits::Type id); \ + void Set##Type(Class##TypeTraits::Type value); \ Class##TypeTraits::Type& Get##Type(); \ - Class##TypeTraits::Type Get##Type() const; + Class##TypeTraits::Type Get##Type() const; \ #define PIMPL_SIMPLE_TYPE_APIS(Class, Type) \ void Class::Set##Type(Class##TypeTraits::Type value) { return m_p##Class##Impl->Set##Type(cd::MoveTemp(value)); } \ @@ -97,9 +97,9 @@ public: \ // Complex Type : customized class, ... in large size //////////////////////////////////////////////////////////////////////////////////////// #define EXPORT_COMPLEX_TYPE_APIS(Class, Type) \ - void Set##Type(Class##TypeTraits::Type id); \ + void Set##Type(Class##TypeTraits::Type value); \ Class##TypeTraits::Type& Get##Type(); \ - const Class##TypeTraits::Type& Get##Type() const; + const Class##TypeTraits::Type& Get##Type() const; \ #define PIMPL_COMPLEX_TYPE_APIS(Class, Type) \ void Class::Set##Type(Class##TypeTraits::Type value) { return m_p##Class##Impl->Set##Type(cd::MoveTemp(value)); } \