mirror of https://github.com/vitalif/openscad
commit
0575b9209c
|
@ -206,7 +206,7 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
|
|||
bool binary = false;
|
||||
std::streampos file_size = f.tellg();
|
||||
f.seekg(80);
|
||||
if (!f.eof()) {
|
||||
if (f.good() && !f.eof()) {
|
||||
uint32_t facenum = 0;
|
||||
f.read((char *)&facenum, sizeof(uint32_t));
|
||||
#ifdef BOOST_BIG_ENDIAN
|
||||
|
@ -220,13 +220,12 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
|
|||
|
||||
char data[5];
|
||||
f.read(data, 5);
|
||||
if (!binary && !f.eof() && !memcmp(data, "solid", 5)) {
|
||||
if (!binary && !f.eof() && f.good() && !memcmp(data, "solid", 5)) {
|
||||
int i = 0;
|
||||
double vdata[3][3];
|
||||
std::string line;
|
||||
std::getline(f, line);
|
||||
while (!f.eof()) {
|
||||
|
||||
std::getline(f, line);
|
||||
boost::trim(line);
|
||||
if (boost::regex_search(line, ex_sfe)) {
|
||||
|
@ -257,7 +256,7 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (binary && !f.eof() && f.good())
|
||||
{
|
||||
f.ignore(80-5+4);
|
||||
while (1) {
|
||||
|
@ -283,10 +282,12 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const
|
|||
else {
|
||||
file >> poly;
|
||||
file.close();
|
||||
|
||||
p = new PolySet();
|
||||
bool err = createPolySetFromPolyhedron(poly, *p);
|
||||
if (err) delete p;
|
||||
if (err) {
|
||||
delete p;
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
PRINT("WARNING: OFF import requires CGAL.");
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// openscad should exit normally.
|
||||
// it should not crash and/or freeze and/or gobble RAM
|
||||
import("../../stl/empty.stl");
|
||||
import("../../stl/empty2.stl");
|
||||
echo("empty stl test ok");
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
solid OpenSCAD_Model
|
||||
endsolid OpenSCAD_Model
|
||||
|
|
@ -824,7 +824,8 @@ list(APPEND ECHO_FILES ${FUNCTION_FILES}
|
|||
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/expression-shortcircuit-tests.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parent_module-tests.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/children-tests.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/range-tests.scad)
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/range-tests.scad
|
||||
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/empty-stl.scad)
|
||||
|
||||
list(APPEND DUMPTEST_FILES ${FEATURES_FILES} ${EXAMPLE_FILES})
|
||||
list(APPEND DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad
|
||||
|
@ -1012,12 +1013,14 @@ add_cmdline_test(openscad-nonascii EXE ${OPENSCAD_BINPATH} ARGS -o
|
|||
|
||||
# Variable override (-D arg)
|
||||
|
||||
# FIXME - this breaks on older cmake that is very common 'in the wild' on linux
|
||||
# Override simple variable
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.10)
|
||||
add_cmdline_test(openscad-override EXE ${OPENSCAD_BINPATH}
|
||||
ARGS -D a=3$<SEMICOLON> -o
|
||||
SUFFIX echo
|
||||
FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/override.scad)
|
||||
|
||||
endif()
|
||||
|
||||
# Image output parameters
|
||||
add_cmdline_test(openscad-imgsize EXE ${OPENSCAD_BINPATH}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ECHO: "empty stl test ok"
|
Loading…
Reference in New Issue