Finally found gcc-4.0 linux problem

Report bugs, bug fixes and workarounds here.
Topic author
doctorjoe
Posts: 76
Joined: 23.05.2005
With us: 19 years 6 months
Location: Austin, Texas

Finally found gcc-4.0 linux problem

Post #1by doctorjoe » 02.07.2005, 05:48

Finally.... I found the problem that caused 3ds not to display on gcc-4.0 linux intel.

The readFloat is not portable. Also the bad code happens to work on Macs which have a different byte order than intel.

[code]
--- 3dsread.cpp 26 Feb 2003 08:12:19 -0000 1.10
+++ 3dsread.cpp 2 Jul 2005 05:44:24 -0000
@@ -56,8 +56,10 @@

static float readFloat(ifstream& in)
{
- int i = readInt(in);
- return *((float*) &i);
+ float ret;
+ in.read((char *) &ret, sizeof(float));
+ LE_TO_CPU_FLOAT(ret, ret);
+ return ret;
}

Return to “Bugs”