Quellcode durchsuchen

Fix: Fix name collision (#5937)

* Fix: Fix name collision

* Fix: Fix possible override

* Fix: Use reentrant providing time function

* Fix: Fix override

* Update AssbinFileWriter.cpp

Revert, not portable.

* Update AssxmlFileWriter.cpp

Revert asctime_r, not portable.
Kim Kulling vor 7 Monaten
Ursprung
Commit
9f3a7e95ab

+ 1 - 1
code/AssetLib/AMF/AMFImporter_Geometry.cpp

@@ -202,7 +202,7 @@ void AMFImporter::ParseNode_Volume(XmlNode &node) {
 
     ((AMFVolume *)ne)->MaterialID = node.attribute("materialid").as_string();
 
-    ((AMFVolume *)ne)->Type = type;
+    ((AMFVolume *)ne)->VolumeType = type;
     // Check for child nodes
     bool col_read = false;
     if (!node.empty()) {

+ 1 - 1
code/AssetLib/AMF/AMFImporter_Node.hpp

@@ -225,7 +225,7 @@ struct AMFVertices : public AMFNodeElementBase {
 /// Structure that define volume node.
 struct AMFVolume : public AMFNodeElementBase {
 	std::string MaterialID; ///< Which material to use.
-	std::string Type; ///< What this volume describes can be "region" or "support". If none specified, "object" is assumed.
+	std::string VolumeType; ///< What this volume describes can be "region" or "support". If none specified, "object" is assumed.
 
 	/// Constructor.
 	/// \param [in] pParent - pointer to parent node.

+ 1 - 3
code/AssetLib/Assxml/AssxmlFileWriter.cpp

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2024, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -36,7 +35,6 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 ----------------------------------------------------------------------
 */
 
@@ -223,7 +221,7 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene,
     const unsigned int majorVersion(aiGetVersionMajor());
     const unsigned int minorVersion(aiGetVersionMinor());
     const unsigned int rev(aiGetVersionRevision());
-    const char *curtime(asctime(p));
+    const char *curtime = asctime(p);
     ioprintf(io, header.c_str(), majorVersion, minorVersion, rev, pFile, c.c_str(), curtime, scene->mFlags, 0u);
 
     // write the node graph

+ 4 - 5
code/AssetLib/glTF/glTFImporter.cpp

@@ -661,11 +661,10 @@ void glTFImporter::ImportEmbeddedTextures(glTF::Asset &r) {
                 if (strncmp(ext, "jpeg", 4) == 0) {
                     ext = "jpg";
                 }
-
-                const size_t len = strlen(ext);
-                if (len <= 3) {
-                    strncpy(tex->achFormatHint, ext, len);
-                }
+                tex->achFormatHint[3] = '\0';
+                size_t len = strlen(ext);
+                if (len > 3) len = 3;
+                memcpy(tex->achFormatHint, ext, len);
             }
         }
     }

+ 4 - 4
code/AssetLib/glTF2/glTF2Importer.cpp

@@ -1638,10 +1638,10 @@ void glTF2Importer::ImportEmbeddedTextures(glTF2::Asset &r) {
                     ext = "bu";
                 }
 
-                const size_t len = strlen(ext);
-                if (len <= 3) {
-                    strncpy(tex->achFormatHint, ext, len);
-                }
+                size_t len = strlen(ext);
+                if (len > 3) len = 3;
+                tex->achFormatHint[3] = '\0';
+                memcpy(tex->achFormatHint, ext, len);
             }
         }
     }