Skip to content
Snippets Groups Projects
Commit ba06f62b authored by vahrenkamp's avatar vahrenkamp
Browse files

minor fixes (linux)

git-svn-id: http://svn.code.sf.net/p/simox/code/trunk@656 042f3d55-54a8-47e9-b7fb-15903f145c44
parent c3d4f8a8
No related branches found
No related tags found
No related merge requests found
......@@ -441,17 +441,18 @@ read_stlb(std::istream& _in, TriMeshModelPtr t) const
int STLReader::read_int(FILE* _in, bool _swap) const
{
union u2 { int i; unsigned char c[4]; } ic;
fread((char*)ic.c, 1, 4, _in);
size_t bytesRead = fread((char*)ic.c, 1, 4, _in);
if (_swap) {
std::swap(ic.c[0], ic.c[3]);
std::swap(ic.c[1], ic.c[2]);
}
return ic.i;
}
float STLReader::read_float(FILE* _in, bool _swap) const
{
union u3 { float f; unsigned char c[4]; } fc;
fread((char*)fc.c, 1, 4, _in);
size_t bytesRead = fread((char*)fc.c, 1, 4, _in);
if (_swap) {
std::swap(fc.c[0], fc.c[3]);
std::swap(fc.c[1], fc.c[2]);
......@@ -477,7 +478,7 @@ check_stl_type(const std::string& _filename) const
// read number of triangles
char dummy[100];
fread(dummy, 1, 80, in);
size_t bytesRead = fread(dummy, 1, 80, in);
size_t nT = read_int(in, swapFlag);
......
......@@ -51,8 +51,8 @@ public:
private:
int STLReader::read_int(FILE* _in, bool _swap) const;
float read_float(std::FILE* _in, bool _swap = false) const;
int read_int(FILE* _in, bool _swap) const;
float read_float(FILE* _in, bool _swap = false) const;
float read_float(std::istream& _in, bool _swap = false) const;
int read_int(std::istream& _in, bool _swap = false) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment