From bf029efd078bfdb1297b78662943734752098ef1 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 22 Jan 2024 16:55:40 +0100 Subject: [PATCH] parser: switch to own endian conversion htonl and htons require Ws2_32.lib on Windows, while we already have endian swapping functions in stdex. Signed-off-by: Simon Rozman --- include/stdex/parser.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/stdex/parser.hpp b/include/stdex/parser.hpp index 2b3df07ca..b9b2ecf11 100644 --- a/include/stdex/parser.hpp +++ b/include/stdex/parser.hpp @@ -6,6 +6,7 @@ #pragma once #include "compat.hpp" +#include "endian.hpp" #include "interval.hpp" #include "memory.hpp" #include "sgml.hpp" @@ -2457,7 +2458,7 @@ namespace stdex if (i < 4) goto error; - value.s_addr = htonl(value.s_addr); + HE2BE(reinterpret_cast(value.s_addr)); this->interval.start = start; return true; @@ -2721,7 +2722,7 @@ namespace stdex goto error; } components[i].end = this->interval.end; - this->value.s6_words[i] = htons((uint16_t)x); + HE2BE(reinterpret_cast(this->value.s6_words[i])); } if (compaction_i != SIZE_MAX) {