diff options
author | bubnikv <bubnikv@gmail.com> | 2019-09-12 11:16:52 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-09-12 11:16:52 +0300 |
commit | 6f4fff1b29476e70a327f8c0c2ca2e16dc6b6a34 (patch) | |
tree | 2328615d4947b1aa48f7268e56569915dd4f9549 | |
parent | 1b1899e24f2315c37ab9203de0fa13f8a94f1446 (diff) |
Fix of 2.1.0-rc2 Fails to open "certain' STL files #2906
-rw-r--r-- | src/admesh/stlinit.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/admesh/stlinit.cpp b/src/admesh/stlinit.cpp index bbf6d3dd5..693aad086 100644 --- a/src/admesh/stlinit.cpp +++ b/src/admesh/stlinit.cpp @@ -179,12 +179,12 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first) // Some G-code generators tend to produce text after "endloop" and "endfacet". Just ignore it. char buf[2048]; fgets(buf, 2047, fp); - bool endloop_ok = strncmp(buf, "endloop", 7) == 0 && (buf[7] == '\n' || buf[7] == ' ' || buf[7] == '\t'); + bool endloop_ok = strncmp(buf, "endloop", 7) == 0 && (buf[7] == '\r' || buf[7] == '\n' || buf[7] == ' ' || buf[7] == '\t'); assert(endloop_ok); // Skip the trailing whitespaces and empty lines. fscanf(fp, " "); fgets(buf, 2047, fp); - bool endfacet_ok = strncmp(buf, "endfacet", 8) == 0 && (buf[8] == '\n' || buf[8] == ' ' || buf[8] == '\t'); + bool endfacet_ok = strncmp(buf, "endfacet", 8) == 0 && (buf[8] == '\r' || buf[8] == '\n' || buf[8] == ' ' || buf[8] == '\t'); assert(endfacet_ok); if (res_normal != 3 || res_outer_loop != 0 || res_vertex1 != 3 || res_vertex2 != 3 || res_vertex3 != 3 || ! endloop_ok || ! endfacet_ok) { BOOST_LOG_TRIVIAL(error) << "Something is syntactically very wrong with this ASCII STL! "; |