Ticket #30 (closed defect: fixed)

Opened 20 months ago

Last modified 20 months ago

x86_64 Portability Bug.

Reported by: ronsaldo Owned by:
Priority: normal Milestone:
Component: Libs Version: svn-head
Keywords: Cc:
Platform: Linux: Ubuntu

Description

I have found a portability bug in a 64 bits Ubuntu build of Cafu, in which an assertion is hit when it tries to loads a map with Bezier patches such TechDemo and TestPatches. The bug is produced because sizeof(unsigned long) == 8 instead of 4 in 64 bits Linux systems.
The attached patch fix the bug so it can load those maps.
Because there is the possibility of another similar bug in another part of Cafu, I added the includes into Nodes.hpp instead of only BezierPatchNode.hpp.

Attachments

fix.patch Download (2.2 KB) - added by ronsaldo 20 months ago.
The bug fix patch

Change History

Changed 20 months ago by ronsaldo

The bug fix patch

Changed 20 months ago by Carsten

  • status changed from new to closed
  • resolution set to fixed

(In [87]) SceneGraph, LP64 bug fix:
Updated class cf::SceneGraph::BezierPatchNodeT to properly serialize its "unsigned long" members,
which are 4 bytes large with ILP32 and LLP64 data models and 8 bytes with the common LP64 data model.
Fixes #30.

Changed 20 months ago by Carsten

Hi Ronsaldo,

I've just applied your patch, but then fixed the problem a bit differently, mostly for consistency with the other SceneGraph node classes, and because there are currently four Bezier patch classes that all use similar unsigned long members:

cf::math::BezierPatchT<>
cf::SceneGraph::BezierPatchNodeT
MapBezierPatchT
MapFileBezierPatchT

Replacing the unsigned longs with the desirable and preferable uint32_t or unsigned int in one of these classes has ripple effects on the other three, and possibly other code as well. So I rather make this change later in a separate revision where I can look into and test all the ramifications.

On all accounts, thank you very much for your report and the patch!

Note: See TracTickets for help on using tickets.