diff options
author | Julien BLACHE | 2010-04-18 15:17:58 +0200 |
---|---|---|
committer | Jonathan Beck | 2010-04-18 15:17:58 +0200 |
commit | 33b8a1281f6fdaa9602956ae20e629b58a2e31ae (patch) | |
tree | 230505465f1eebbdd25efb80db1e6b863fde7650 /include/plist/String.h | |
parent | eb618a0c5c7a3893fc18a8f1e5d39854aa25c597 (diff) | |
download | libplist-33b8a1281f6fdaa9602956ae20e629b58a2e31ae.tar.gz libplist-33b8a1281f6fdaa9602956ae20e629b58a2e31ae.tar.bz2 |
Endianness, alignment and type-punning fixes for binary plist support
- 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.
Diffstat (limited to 'include/plist/String.h')
0 files changed, 0 insertions, 0 deletions