Commit 704fffc4 authored by Jan Möbius's avatar Jan Möbius
Browse files

Fixed more size_t warnings

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@559 fdac6126-5c0c-442c-9429-916003d36597
parent 118202c4
...@@ -589,7 +589,7 @@ bool _OFFReader_::can_u_read(std::istream& _is) const ...@@ -589,7 +589,7 @@ bool _OFFReader_::can_u_read(std::istream& _is) const
_is.getline(line, LINE_LEN); _is.getline(line, LINE_LEN);
p = line; p = line;
int remainingChars = _is.gcount(); size_t remainingChars = _is.gcount();
bool vertexDimensionTooHigh = false; bool vertexDimensionTooHigh = false;
...@@ -615,7 +615,12 @@ bool _OFFReader_::can_u_read(std::istream& _is) const ...@@ -615,7 +615,12 @@ bool _OFFReader_::can_u_read(std::istream& _is) const
return false; return false;
p += 4; p += 4;
remainingChars -= 4;
// Detect possible garbage and make sure, we don't have an underflow
if ( remainingChars >= 4 )
remainingChars -= 4;
else
remainingChars = 0;
if ( ( remainingChars >= 6 ) && ( strncmp(p, "BINARY", 6) == 0 ) ) if ( ( remainingChars >= 6 ) && ( strncmp(p, "BINARY", 6) == 0 ) )
options_+= Options::Binary; options_+= Options::Binary;
......
...@@ -892,7 +892,7 @@ bool _PLYReader_::can_u_read(std::istream& _is) const { ...@@ -892,7 +892,7 @@ bool _PLYReader_::can_u_read(std::istream& _is) const {
return false; return false;
} }
unsigned int streamPos = _is.tellg(); size_t streamPos = _is.tellg();
_is >> keyword; _is >> keyword;
while (keyword != "end_header") { while (keyword != "end_header") {
......
...@@ -365,15 +365,15 @@ check_stl_type(const std::string& _filename) const ...@@ -365,15 +365,15 @@ check_stl_type(const std::string& _filename) const
// read number of triangles // read number of triangles
char dummy[100]; char dummy[100];
fread(dummy, 1, 80, in); fread(dummy, 1, 80, in);
unsigned int nT = read_int(in, swapFlag); size_t nT = read_int(in, swapFlag);
// compute file size from nT // compute file size from nT
unsigned int binary_size = 84 + nT*50; size_t binary_size = 84 + nT*50;
// get actual file size // get actual file size
unsigned int file_size(0); size_t file_size(0);
rewind(in); rewind(in);
while (!feof(in)) while (!feof(in))
file_size += fread(dummy, 1, 100, in); file_size += fread(dummy, 1, 100, in);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment