From: Ian Jackson Date: Thu, 25 Jul 2013 17:30:51 +0000 (+0100) Subject: site: use unaligned.h's functions, not pointer cast and ntohl X-Git-Tag: debian/0.3.0_beta2~14 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=0a6cbadea08d824e26838a18bb75745c78f27461;hp=0a6cbadea08d824e26838a18bb75745c78f27461;p=secnet.git site: use unaligned.h's functions, not pointer cast and ntohl Switch site.c to using unaligned.h's functions for accessing multi-byte values inside messages. There were a few places where this construction was used: something = ntohl(*(uint32_t*)(buf->start + offset)); It is much clearer to use this equivalent construction: something = get_uint32(buf->start + offset); Also the packet's message type was extracted from the message using get_uint32 and then put through ntohl. This is, of course, wrong. Currently all the message type codes are palindromes, so it doesn't matter in practice. Fix it anyway. Signed-off-by: Ian Jackson ---