]> OCCT Git - occt.git/commitdiff
0030113: Data Exchange - STL file in text format with "Facet" keywords can't be imported
authorgka <gka@opencascade.com>
Thu, 12 Sep 2019 13:30:09 +0000 (16:30 +0300)
committerabv <abv@opencascade.com>
Sat, 14 Sep 2019 08:45:36 +0000 (11:45 +0300)
Case-sensitive method strncmp used in the REStl_Reader cosidered register of letter was replaced on the method _strnicmp for Windows and strncasecmp for Linux and MacOs
Test script for case 0030113

src/RWStl/RWStl_Reader.cxx
tests/bugs/stlvrml/bug30113 [new file with mode: 0644]

index f7a5e0eb4718e1a9d3b94fc089b9d724955b1438..556f31fd94ad521135a7c425d02bb82c89e6a882 100644 (file)
@@ -236,10 +236,14 @@ Standard_Boolean RWStl_Reader::IsAscii (Standard_IStream& theStream)
   #define GETPOS(aPos) ((int64_t)aPos)
 #endif
 
+# if defined(_MSC_VER) && ! defined(strncasecmp)
+#  define strncasecmp _strnicmp
+# endif
+
 static inline bool str_starts_with (const char* theStr, const char* theWord, int theN)
 {
   while (isspace (*theStr) && *theStr != '\0') theStr++;
-  return !strncmp (theStr, theWord, theN);
+  return !strncasecmp (theStr, theWord, theN); 
 }
 
 static bool ReadVertex (const char* theStr, double& theX, double& theY, double& theZ)
diff --git a/tests/bugs/stlvrml/bug30113 b/tests/bugs/stlvrml/bug30113
new file mode 100644 (file)
index 0000000..d066733
--- /dev/null
@@ -0,0 +1,8 @@
+readstl a [locate_data_file bug30113.stl]
+
+# Number of triangles check
+checktrinfo a -tri 14248 -nod 7114
+
+# Visual check
+checkview -display a -3d -vdispmode 0 -path ${imagedir}/${test_image}_edges.png
+checkview -display a -3d -vdispmode 1 -path ${imagedir}/${test_image}_shading.png