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

* obj: avoid extra scanning while reading faces

---------

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
This commit is contained in:
Vitaly Ovchinnikov
2026-01-14 18:43:36 +03:00
committed by GitHub
parent 1ce99b9cf7
commit d8a9074cd0

View File

@@ -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;