浏览代码

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
Kim Kulling 4 年之前
父节点
当前提交
4471c36c08
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      code/AssetLib/FBX/FBXMaterial.cpp

+ 7 - 7
code/AssetLib/FBX/FBXMaterial.cpp

@@ -60,12 +60,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 namespace Assimp {
 namespace Assimp {
 namespace FBX {
 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 Scope& sc = GetRequiredScope(element);
 
 
     const Element* const ShadingModel = sc["ShadingModel"];
     const Element* const ShadingModel = sc["ShadingModel"];
@@ -77,8 +76,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
 
 
     if(ShadingModel) {
     if(ShadingModel) {
         shading = ParseTokenAsString(GetRequiredToken(*ShadingModel,0));
         shading = ParseTokenAsString(GetRequiredToken(*ShadingModel,0));
-    }
-    else {
+    } else {
         DOMWarning("shading mode not specified, assuming phong",&element);
         DOMWarning("shading mode not specified, assuming phong",&element);
         shading = "phong";
         shading = "phong";
     }
     }
@@ -86,7 +84,9 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
     std::string templateName;
     std::string templateName;
 
 
     // lower-case shading because Blender (for example) writes "Phong"
     // lower-case shading because Blender (for example) writes "Phong"
-    std::transform(shading.data(), shading.data() + shading.size(), std::addressof(shading[0]), Assimp::ToLower<char>);
+    for (size_t i = 0; i < shading.length(); ++i) {
+        shading[i] = tolower(shading[i]);
+    }
     if(shading == "phong") {
     if(shading == "phong") {
         templateName = "Material.FbxSurfacePhong";
         templateName = "Material.FbxSurfacePhong";
     }
     }