From: Sebastian Harl Date: Wed, 24 Dec 2014 15:49:55 +0000 (+0100) Subject: proto: Use hton instead of ntoh functions in marshal functions. X-Git-Tag: sysdb-0.7.0~94 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=2967ce96a6701bf4bd81b6781ad906ee116f08ec proto: Use hton instead of ntoh functions in marshal functions. D'oh! --- diff --git a/src/utils/proto.c b/src/utils/proto.c index f543dd6..5a7a2e3 100644 --- a/src/utils/proto.c +++ b/src/utils/proto.c @@ -69,8 +69,8 @@ marshal_int64(char *buf, size_t buf_len, int64_t v) { if (buf_len >= sizeof(v)) { #if __BYTE_ORDER != __BIG_ENDIAN - v = (((int64_t)ntohl((int32_t)v)) << 32) - + ((int64_t)ntohl((int32_t)(v >> 32))); + v = (((int64_t)htonl((int32_t)v)) << 32) + + ((int64_t)htonl((int32_t)(v >> 32))); #endif memcpy(buf, &v, sizeof(v)); } @@ -84,8 +84,8 @@ marshal_double(char *buf, size_t buf_len, double v) assert(sizeof(v) == sizeof(t)); memcpy(&t, &v, sizeof(v)); #if IEEE754_DOUBLE_BYTE_ORDER != IEEE754_DOUBLE_BIG_ENDIAN - t = (((int64_t)ntohl((int32_t)t)) << 32) - + ((int64_t)ntohl((int32_t)(t >> 32))); + t = (((int64_t)htonl((int32_t)t)) << 32) + + ((int64_t)htonl((int32_t)(t >> 32))); #endif if (buf_len >= sizeof(t)) memcpy(buf, &t, sizeof(t));