byte-order of generated divesite UUIDs

Lubomir I. Ivanov neolit123 at gmail.com
Thu Oct 1 08:32:15 PDT 2015


after seeing a warning about strict-aliasing in:
divesite.c: create_divesite_uuid()

i think i found a potential problem. the cast at the end of the
function can have different results on big/little endian machines,
while i'm pretty sure we want the same result on both.

if the first 4 bytes of the SHA1 are:
01 02 03 04

we want them serialized in the XML always as:
<site uuid=''01020304" .../>

on big endian machines that will be the result, while on little endian
the result would be:
<site uuid=''04030201" .../>
for that same divesite (and unless i'm missing something).

patch attached.

lubomir
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-divesite.c-preserve-byte-order-in-create_divesite_uu.patch
Type: text/x-patch
Size: 1198 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151001/09141006/attachment.bin>


More information about the subsurface mailing list