From: gka Date: Thu, 12 Sep 2019 13:30:09 +0000 (+0300) Subject: 0030113: Data Exchange - STL file in text format with "Facet" keywords can't be imported X-Git-Tag: V7_4_0_beta~1 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d45b7860a59337386eb0fa71a08646a6d7eb4733;p=occt.git 0030113: Data Exchange - STL file in text format with "Facet" keywords can't be imported 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 --- diff --git a/src/RWStl/RWStl_Reader.cxx b/src/RWStl/RWStl_Reader.cxx index f7a5e0eb47..556f31fd94 100644 --- a/src/RWStl/RWStl_Reader.cxx +++ b/src/RWStl/RWStl_Reader.cxx @@ -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 index 0000000000..d066733557 --- /dev/null +++ b/tests/bugs/stlvrml/bug30113 @@ -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