chiark / gitweb /
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 <ijackson@chiark.greenend.org.uk>