From 66232b481862c2ad5fc66ec35b6be68c7bf4d277 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 30 Jan 2017 18:00:46 +0000 Subject: Attempt to fix the PPC bug. FUCK REPRESENTATION OF CHARS WITH A CHAINSAW, SIDEWAYS. --- src/libs6dns/s6dns_message_header_pack.c | 2 +- src/libs6dns/s6dns_message_header_unpack.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libs6dns') diff --git a/src/libs6dns/s6dns_message_header_pack.c b/src/libs6dns/s6dns_message_header_pack.c index 99ffa8a..ff496fa 100644 --- a/src/libs6dns/s6dns_message_header_pack.c +++ b/src/libs6dns/s6dns_message_header_pack.c @@ -6,7 +6,7 @@ void s6dns_message_header_pack (char *s, s6dns_message_header_t const *h) { uint16_pack_big(s, h->id) ; - s[2] = (h->qr << 7) | (h->opcode << 3) | (h->aa << 2) | (h->tc << 1) | h->rd ; + s[2] = (char)(unsigned char)((h->qr << 7) | (h->opcode << 3) | (h->aa << 2) | (h->tc << 1) | h->rd) ; s[3] = (h->z << 4) | h->rcode ; s6dns_message_counts_pack(s+4, &h->counts) ; } diff --git a/src/libs6dns/s6dns_message_header_unpack.c b/src/libs6dns/s6dns_message_header_unpack.c index ae2b35c..8b12ca9 100644 --- a/src/libs6dns/s6dns_message_header_unpack.c +++ b/src/libs6dns/s6dns_message_header_unpack.c @@ -6,7 +6,7 @@ void s6dns_message_header_unpack (char const *s, s6dns_message_header_t *h) { uint16_unpack_big(s, &h->id) ; - h->qr = s[2] & 0x8000U ? 1 : 0 ; + h->qr = ((unsigned char *)s)[2] & 0x8000U ? 1 : 0 ; h->opcode = (s[2] >> 3) & 15 ; h->aa = s[2] & 4 ? 1 : 0 ; h->tc = s[2] & 2 ? 1 : 0 ; -- cgit v1.2.3