Replace duplicated trim (#5613)
parent
e963a863ce
commit
75a10fedd0
|
@ -343,7 +343,7 @@ void ObjFileMtlImporter::createMaterial() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
name = trim_whitespaces(name);
|
name = ai_trim(name);
|
||||||
|
|
||||||
std::map<std::string, ObjFile::Material *>::iterator it = m_pModel->mMaterialMap.find(name);
|
std::map<std::string, ObjFile::Material *>::iterator it = m_pModel->mMaterialMap.find(name);
|
||||||
if (m_pModel->mMaterialMap.end() == it) {
|
if (m_pModel->mMaterialMap.end() == it) {
|
||||||
|
|
|
@ -577,7 +577,7 @@ void ObjFileParser::getMaterialDesc() {
|
||||||
|
|
||||||
// Get name
|
// Get name
|
||||||
std::string strName(pStart, &(*m_DataIt));
|
std::string strName(pStart, &(*m_DataIt));
|
||||||
strName = trim_whitespaces(strName);
|
strName = ai_trim(strName);
|
||||||
if (strName.empty()) {
|
if (strName.empty()) {
|
||||||
skip = true;
|
skip = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,22 +247,6 @@ inline char_t getFloat(char_t it, char_t end, ai_real &value) {
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Will remove white-spaces for a string.
|
|
||||||
* @param[in] str The string to clean
|
|
||||||
* @return The trimmed string.
|
|
||||||
*/
|
|
||||||
template <class string_type>
|
|
||||||
inline string_type trim_whitespaces(string_type str) {
|
|
||||||
while (!str.empty() && IsSpace(str[0])) {
|
|
||||||
str.erase(0);
|
|
||||||
}
|
|
||||||
while (!str.empty() && IsSpace(str[str.length() - 1])) {
|
|
||||||
str.erase(str.length() - 1);
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks for a line-end.
|
* @brief Checks for a line-end.
|
||||||
* @param[in] it Current iterator in string.
|
* @param[in] it Current iterator in string.
|
||||||
|
|
Loading…
Reference in New Issue