| Attached Files | InvalidSurface.stl [^] (81 bytes) 2014-01-15 10:00
stl-fclose.patch [^] (3,296 bytes) 2014-01-15 10:02 [Show Content] [Hide Content]diff --git a/IO/Geometry/vtkSTLReader.cxx b/IO/Geometry/vtkSTLReader.cxx
index ad5de63..44f4606 100644
--- a/IO/Geometry/vtkSTLReader.cxx
+++ b/IO/Geometry/vtkSTLReader.cxx
@@ -126,6 +126,7 @@ int vtkSTLReader::RequestData(
}
if ( this->ReadASCIISTL(fp,newPts,newPolys,newScalars) )
{
+ fclose(fp);
return 1;
}
}
@@ -135,6 +136,7 @@ int vtkSTLReader::RequestData(
fp = fopen(this->FileName, "rb");
if ( this->ReadBinarySTL(fp,newPts,newPolys) )
{
+ fclose(fp);
return 1;
}
}
@@ -256,14 +258,12 @@ int vtkSTLReader::ReadBinarySTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading header.");
- fclose(fp);
return 0;
}
if (fread (&ulint, 1, 4, fp) != 4)
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading header.");
- fclose(fp);
return 0;
}
vtkByteSwap::Swap4LE(&ulint);
@@ -295,7 +295,6 @@ int vtkSTLReader::ReadBinarySTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading extra junk.");
- fclose(fp);
return 0;
}
@@ -376,7 +375,6 @@ int vtkSTLReader::ReadASCIISTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading point.");
- fclose(fp);
return 0;
}
@@ -385,7 +383,6 @@ int vtkSTLReader::ReadASCIISTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading point.");
- fclose(fp);
return 0;
}
@@ -394,7 +391,6 @@ int vtkSTLReader::ReadASCIISTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading point.");
- fclose(fp);
return 0;
}
@@ -403,14 +399,12 @@ int vtkSTLReader::ReadASCIISTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading end loop.");
- fclose(fp);
return 0;
}
if (!fgets (line, 255, fp)) // end facet
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading end facet.");
- fclose(fp);
return 0;
}
@@ -433,7 +427,6 @@ int vtkSTLReader::ReadASCIISTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading solid.");
- fclose(fp);
return 0;
}
@@ -449,7 +442,6 @@ int vtkSTLReader::ReadASCIISTL(FILE *fp, vtkPoints *newPts,
{
vtkErrorMacro ("STLReader error reading file: " << this->FileName
<< " Premature EOF while reading end solid.");
- fclose(fp);
return 0;
}
}
|