From 4471c36c087c0a36a6dfd9aee01cdce520f8df2d Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 26 Jan 2021 20:59:21 +0100 Subject: [PATCH] Fix compiler bug for VS2019 - Check https://developercommunity.visualstudio.com/content/problem/1223143/visual-studio-2019-c-program-crash-with-stdstring.html for more details - closes https://github.com/assimp/assimp/issues/3572 --- code/AssetLib/FBX/FBXMaterial.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/AssetLib/FBX/FBXMaterial.cpp b/code/AssetLib/FBX/FBXMaterial.cpp index 9fe4ce5be..2d727d16e 100644 --- a/code/AssetLib/FBX/FBXMaterial.cpp +++ b/code/AssetLib/FBX/FBXMaterial.cpp @@ -60,12 +60,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { namespace FBX { - using namespace Util; +using namespace Util; // ------------------------------------------------------------------------------------------------ -Material::Material(uint64_t id, const Element& element, const Document& doc, const std::string& name) -: Object(id,element,name) -{ +Material::Material(uint64_t id, const Element& element, const Document& doc, const std::string& name) : + Object(id,element,name) { const Scope& sc = GetRequiredScope(element); const Element* const ShadingModel = sc["ShadingModel"]; @@ -77,8 +76,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con if(ShadingModel) { shading = ParseTokenAsString(GetRequiredToken(*ShadingModel,0)); - } - else { + } else { DOMWarning("shading mode not specified, assuming phong",&element); shading = "phong"; } @@ -86,7 +84,9 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con std::string templateName; // lower-case shading because Blender (for example) writes "Phong" - std::transform(shading.data(), shading.data() + shading.size(), std::addressof(shading[0]), Assimp::ToLower); + for (size_t i = 0; i < shading.length(); ++i) { + shading[i] = tolower(shading[i]); + } if(shading == "phong") { templateName = "Material.FbxSurfacePhong"; }