ソースを参照

Fix bug #50932: LWIP-provided byteorder functions defined in the wrong scope
Apply suggested fix from "Fayek"
(cherry picked from commit fe8c62e7b64559ed43199e1b6e830e75f6079aed)

Dirk Ziegelmeier 8 年 前
コミット
c6b19cad34
1 ファイル変更8 行追加9 行削除
  1. 8 9
      src/include/lwip/def.h

+ 8 - 9
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