# HG changeset patch # User Benoit Boissinot # Date 1224354226 -7200 # Node ID 42db22108d85904acbd5ac55331c9ba5b31c7f78 # Parent b801d6e5dc834a8fc5d2039d5800dfaf438996fa revlog parser: use ntohl() instead of ntohll() (fix endianness issues) diff -r b801d6e5dc83 -r 42db22108d85 mercurial/parsers.c --- a/mercurial/parsers.c Sat Oct 18 04:26:09 2008 -0500 +++ b/mercurial/parsers.c Sat Oct 18 20:23:46 2008 +0200 @@ -234,13 +234,6 @@ return ret; } - -static inline uint64_t ntohll(uint64_t x) -{ - return (((uint64_t)ntohl((uint32_t)x)) << 32) | - (uint64_t)ntohl((uint32_t)(x >> 32)); -} - const char nullid[20]; const int nullrev = -1; @@ -266,9 +259,14 @@ const char *end = data + size; while (data < end) { - offset_flags = ntohll(*((uint64_t *) data)); - if (n == 0) /* mask out version number for the first entry */ - offset_flags &= 0xFFFF; + offset_flags = ntohl(*((uint32_t *) (data + 4))); + if (n == 0) /* mask out version number for the first entry */ + offset_flags &= 0xFFFF; + else { + uint32_t offset_high = ntohl(*((uint32_t *) data)); + offset_flags |= ((uint64_t) offset_high) << 32; + } + comp_len = ntohl(*((uint32_t *) (data + 8))); uncomp_len = ntohl(*((uint32_t *) (data + 12)));