x86_64 Portability Bug.

Issue #30 resolved
Ronie Salgado created an issue

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.

Comments (3)

  1. Carsten Fuchs

    (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.

  2. Carsten Fuchs

    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:


    Replacing the `unsigned long`s 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!

  3. Log in to comment