From 85da06f0c4adb3f1fa238e5292d1a3f49f7f9815 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 10 Sep 2023 13:58:36 +0100 Subject: Apply same length check to built-in strings --- slicer/slicer/modelPartsTypes.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index b34bbc8..e78c6c6 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -74,19 +74,21 @@ namespace Slicer { return name; } -#define Roots(Type, Name) \ - template<> constinit const std::string Slicer::ModelPartForRoot::rootName {#Name}; \ - template<> constinit const std::string Slicer::ModelPartForRoot>::rootName {"Optional" #Name}; \ +#define Roots(Type, Name, NameLen) \ + template<> CONSTSTR(NameLen) Slicer::ModelPartForRoot::rootName {#Name}; \ + template<> \ + CONSTSTR(BOOST_PP_ADD(8, NameLen)) \ + Slicer::ModelPartForRoot>::rootName {"Optional" #Name}; \ MODELPARTFOR(Type, ModelPartForSimple) - Roots(std::string, String); - Roots(bool, Boolean); - Roots(Ice::Float, Float); - Roots(Ice::Double, Double); - Roots(Ice::Byte, Byte); - Roots(Ice::Short, Short); - Roots(Ice::Int, Int); - Roots(Ice::Long, Long); + Roots(std::string, String, 6); + Roots(bool, Boolean, 8); + Roots(Ice::Float, Float, 5); + Roots(Ice::Double, Double, 6); + Roots(Ice::Byte, Byte, 4); + Roots(Ice::Short, Short, 5); + Roots(Ice::Int, Int, 3); + Roots(Ice::Long, Long, 4); #undef RootNames bool -- cgit v1.2.3