Procházet zdrojové kódy

OBJ: avoid extra scanning while reading faces in ObjFileParser.cpp (#6281)

* obj: avoid extra scanning while reading faces

---------

Co-authored-by: Kim Kulling <[email protected]>
Vitaly Ovchinnikov před 1 týdnem
rodič
revize
d8a9074cd0
1 změnil soubory, kde provedl 2 přidání a 14 odebrání
  1. 2 14
      code/AssetLib/Obj/ObjFileParser.cpp

+ 2 - 14
code/AssetLib/Obj/ObjFileParser.cpp

@@ -3,7 +3,7 @@
 Open Asset Import Library (assimp)
 ---------------------------------------------------------------------------
 
-Copyright (c) 2006-2025, assimp team
+Copyright (c) 2006-2026, assimp team
 
 All rights reserved.
 
@@ -471,19 +471,7 @@ void ObjFileParser::getFace(aiPrimitiveType type) {
             iPos = 0;
         } else {
             //OBJ USES 1 Base ARRAYS!!!!
-            int iVal;
-            auto end = m_DataIt;
-            // find either the buffer end or the '\0'
-            while (end < m_DataItEnd && *end != '\0')
-                ++end;
-            // avoid temporary string allocation if there is a zero
-            if (end != m_DataItEnd) {
-                iVal = ::atoi(&(*m_DataIt));
-            } else {
-                // otherwise make a zero terminated copy, which is safe to pass to atoi
-                std::string number(&(*m_DataIt), m_DataItEnd - m_DataIt);
-                iVal = ::atoi(number.c_str());
-            }
+            const int iVal = ::atoi(&(*m_DataIt));
 
             // increment iStep position based off of the sign and # of digits
             int tmp = iVal;