From c6b19cad342f6fcde84cfefc784dce3a881a1286 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Wed, 3 May 2017 22:28:46 +0200 Subject: [PATCH] Fix bug #50932: LWIP-provided byteorder functions defined in the wrong scope Apply suggested fix from "Fayek" (cherry picked from commit fe8c62e7b64559ed43199e1b6e830e75f6079aed) --- src/include/lwip/def.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/include/lwip/def.h b/src/include/lwip/def.h index aaa64c77..82a9d896 100644 --- a/src/include/lwip/def.h +++ b/src/include/lwip/def.h @@ -91,14 +91,6 @@ u32_t lwip_htonl(u32_t x); #endif #define lwip_ntohl(x) lwip_htonl(x) -/* Provide usual function names as macros for users, but this can be turned off */ -#ifndef LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS -#define htons(x) lwip_htons(x) -#define ntohs(x) lwip_ntohs(x) -#define htonl(x) lwip_htonl(x) -#define ntohl(x) lwip_ntohl(x) -#endif - /* These macros should be calculated by the preprocessor and are used with compile-time constants only (so that there is no little-endian overhead at runtime). */ @@ -109,9 +101,16 @@ u32_t lwip_htonl(u32_t x); (((x) & 0x00ff0000UL) >> 8) | \ (((x) & 0xff000000UL) >> 24)) #define PP_NTOHL(x) PP_HTONL(x) - #endif /* BYTE_ORDER == BIG_ENDIAN */ +/* Provide usual function names as macros for users, but this can be turned off */ +#ifndef LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS +#define htons(x) lwip_htons(x) +#define ntohs(x) lwip_ntohs(x) +#define htonl(x) lwip_htonl(x) +#define ntohl(x) lwip_ntohl(x) +#endif + /* Functions that are not available as standard implementations. * In cc.h, you can #define these to implementations available on * your platform to save some code bytes if you use these functions