##// END OF EJS Templates
revlog parser: use ntohl() instead of ntohll() (fix endianness issues)
Benoit Boissinot -
r7133:42db2210 default
parent child Browse files
Show More
@@ -234,13 +234,6 b' quit:'
234 return ret;
234 return ret;
235 }
235 }
236
236
237
238 static inline uint64_t ntohll(uint64_t x)
239 {
240 return (((uint64_t)ntohl((uint32_t)x)) << 32) |
241 (uint64_t)ntohl((uint32_t)(x >> 32));
242 }
243
244 const char nullid[20];
237 const char nullid[20];
245 const int nullrev = -1;
238 const int nullrev = -1;
246
239
@@ -266,9 +259,14 b' static int _parse_index_ng (const char *'
266 const char *end = data + size;
259 const char *end = data + size;
267
260
268 while (data < end) {
261 while (data < end) {
269 offset_flags = ntohll(*((uint64_t *) data));
262 offset_flags = ntohl(*((uint32_t *) (data + 4)));
270 if (n == 0) /* mask out version number for the first entry */
263 if (n == 0) /* mask out version number for the first entry */
271 offset_flags &= 0xFFFF;
264 offset_flags &= 0xFFFF;
265 else {
266 uint32_t offset_high = ntohl(*((uint32_t *) data));
267 offset_flags |= ((uint64_t) offset_high) << 32;
268 }
269
272
270
273 comp_len = ntohl(*((uint32_t *) (data + 8)));
271 comp_len = ntohl(*((uint32_t *) (data + 8)));
274 uncomp_len = ntohl(*((uint32_t *) (data + 12)));
272 uncomp_len = ntohl(*((uint32_t *) (data + 12)));
General Comments 0
You need to be logged in to leave comments. Login now