Преглед на файлове

More `constexpr` (#6066)

Co-authored-by: Krishty <[email protected]>
Co-authored-by: Kim Kulling <[email protected]>
krishty преди 5 месеца
родител
ревизия
55e6359436

+ 1 - 1
code/AssetLib/3DS/3DSLoader.cpp

@@ -106,7 +106,7 @@ Discreet3DSImporter::Discreet3DSImporter() :
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool Discreet3DSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint16_t token[] = { 0x4d4d, 0x3dc2 /*, 0x3daa */ };
+    static constexpr uint16_t token[] = { 0x4d4d, 0x3dc2 /*, 0x3daa */ };
     return CheckMagicToken(pIOHandler, pFile, token, AI_COUNT_OF(token), 0, sizeof token[0]);
 }
 

+ 1 - 1
code/AssetLib/3MF/D3MFImporter.cpp

@@ -85,7 +85,7 @@ bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bo
     if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {
         return false;
     }
-    static const char *const ModelRef = "3D/3dmodel.model";
+    static constexpr char ModelRef[] = "3D/3dmodel.model";
     ZipArchiveIOSystem archive(pIOHandler, filename);
     if (!archive.Exists(ModelRef)) {
         return false;

+ 1 - 1
code/AssetLib/AC/ACLoader.cpp

@@ -147,7 +147,7 @@ AC3DImporter::AC3DImporter() :
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool AC3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint32_t tokens[] = { AI_MAKE_MAGIC("AC3D") };
+    static constexpr uint32_t tokens[] = { AI_MAKE_MAGIC("AC3D") };
     return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
 }
 

+ 1 - 1
code/AssetLib/Blender/BlenderLoader.cpp

@@ -108,7 +108,7 @@ BlenderImporter::~BlenderImporter() {
     delete modifier_cache;
 }
 
-static const char Token[] = "BLENDER";
+static constexpr char Token[] = "BLENDER";
 
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.

+ 1 - 1
code/AssetLib/HMP/HMPLoader.cpp

@@ -81,7 +81,7 @@ HMPImporter::~HMPImporter() = default;
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool HMPImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint32_t tokens[] = {
+    static constexpr uint32_t tokens[] = {
         AI_HMP_MAGIC_NUMBER_LE_4,
         AI_HMP_MAGIC_NUMBER_LE_5,
         AI_HMP_MAGIC_NUMBER_LE_7

+ 1 - 1
code/AssetLib/LWO/LWOLoader.cpp

@@ -104,7 +104,7 @@ LWOImporter::~LWOImporter() = default;
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool LWOImporter::CanRead(const std::string &file, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint32_t tokens[] = {
+    static constexpr uint32_t tokens[] = {
         AI_LWO_FOURCC_LWOB,
         AI_LWO_FOURCC_LWO2,
         AI_LWO_FOURCC_LXOB

+ 1 - 1
code/AssetLib/LWS/LWSLoader.cpp

@@ -149,7 +149,7 @@ LWSImporter::LWSImporter() :
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool LWSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint32_t tokens[] = {
+    static constexpr uint32_t tokens[] = {
         AI_MAKE_MAGIC("LWSC"),
         AI_MAKE_MAGIC("LWMO")
     };

+ 1 - 1
code/AssetLib/MD2/MD2Loader.cpp

@@ -101,7 +101,7 @@ MD2Importer::MD2Importer()
 // Returns whether the class can handle the format of the given file.
 bool MD2Importer::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const
 {
-    static const uint32_t tokens[] = { AI_MD2_MAGIC_NUMBER_LE };
+    static constexpr uint32_t tokens[] = { AI_MD2_MAGIC_NUMBER_LE };
     return CheckMagicToken(pIOHandler,pFile,tokens,AI_COUNT_OF(tokens));
 }
 

+ 1 - 1
code/AssetLib/MD3/MD3Loader.cpp

@@ -352,7 +352,7 @@ MD3Importer::~MD3Importer() = default;
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool MD3Importer::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint32_t tokens[] = { AI_MD3_MAGIC_NUMBER_LE };
+    static constexpr uint32_t tokens[] = { AI_MD3_MAGIC_NUMBER_LE };
     return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
 }
 

+ 1 - 1
code/AssetLib/MDC/MDCLoader.cpp

@@ -106,7 +106,7 @@ MDCImporter::MDCImporter() :
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool MDCImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint32_t tokens[] = { AI_MDC_MAGIC_NUMBER_LE };
+    static constexpr uint32_t tokens[] = { AI_MDC_MAGIC_NUMBER_LE };
     return CheckMagicToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
 }
 

+ 1 - 1
code/AssetLib/USD/USDLoader.cpp

@@ -88,7 +88,7 @@ USDImporter::USDImporter() :
 
 bool USDImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool) const {
     // Based on token
-    static const uint32_t usdcTokens[] = { AI_MAKE_MAGIC("PXR-USDC") };
+    static constexpr uint32_t usdcTokens[] = { AI_MAKE_MAGIC("PXR-USDC") };
     bool canRead = CheckMagicToken(pIOHandler, pFile, usdcTokens, AI_COUNT_OF(usdcTokens));
     if (canRead) {
         return canRead;

+ 1 - 1
code/AssetLib/X/XFileImporter.cpp

@@ -77,7 +77,7 @@ static constexpr aiImporterDesc desc = {
 // ------------------------------------------------------------------------------------------------
 // Returns whether the class can handle the format of the given file.
 bool XFileImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
-    static const uint32_t token[] = { AI_MAKE_MAGIC("xof ") };
+    static constexpr uint32_t token[] = { AI_MAKE_MAGIC("xof ") };
     return CheckMagicToken(pIOHandler, pFile, token, AI_COUNT_OF(token));
 }
 

+ 1 - 1
code/AssetLib/X3D/X3DImporter.cpp

@@ -89,7 +89,7 @@ void X3DImporter::checkNodeMustBeEmpty(XmlNode &node) {
 
 void X3DImporter::skipUnsupportedNode(const std::string &pParentNodeName, XmlNode &node) {
     static const size_t Uns_Skip_Len = 192;
-    static const char *Uns_Skip[Uns_Skip_Len] = {
+    static constexpr char const * Uns_Skip[Uns_Skip_Len] = {
         // CAD geometry component
         "CADAssembly", "CADFace", "CADLayer", "CADPart", "IndexedQuadSet", "QuadSet",
         // Core