• Julien BLACHE's avatar
    Endianness, alignment and type-punning fixes for binary plist support · 33b8a128
    Julien BLACHE authored
     - endianness issues: on big endian machines, writing out only part
       of an integer was broken (get_needed_bytes(x) < sizeof(x))
        -> shift integer before memcpy() on big endian machines
    
     - alignment issues: unaligned reads when loading binary plist. Leads
       to slow runtime performance (kernel trapping and fixing things up),
       SIGBUS (kernel not helping us out)
        -> introduce get_unaligned() and have the compiler generate the code
           needed for the unaligned access
       (note that there remains unaligned accesses that I haven't been able
        to track down - I've seen 2 of them with test #2)
    
     - type-punning issues: breaking strict aliasing rules can lead to
       unexpected results as the compiler takes full advantage of the aliasing
       while optimizing
        -> introduce the plist_uint_ptr union instead of casting pointers
    
    Tested on amd64, alpha and hppa.
    33b8a128
Name
Last commit
Last update
..
Array.cpp Loading commit data...
Boolean.cpp Loading commit data...
CMakeLists.txt Loading commit data...
Data.cpp Loading commit data...
Date.cpp Loading commit data...
Dictionary.cpp Loading commit data...
Integer.cpp Loading commit data...
Node.cpp Loading commit data...
Real.cpp Loading commit data...
String.cpp Loading commit data...
Structure.cpp Loading commit data...
bplist.c Loading commit data...
plist.c Loading commit data...
plist.h Loading commit data...
xplist.c Loading commit data...