]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: fix warnings found when porting to NuttX
authorXiang Xiao <xiaoxiang@xiaomi.com>
Tue, 24 Dec 2019 13:28:32 +0000 (21:28 +0800)
committerJay Satiro <raysatiro@yahoo.com>
Sat, 28 Dec 2019 03:52:31 +0000 (22:52 -0500)
- Undefine DEBUGASSERT in curl_setup_once.h in case it was already
  defined as a system macro.

- Don't compile write32_le in curl_endian unless
  CURL_SIZEOF_CURL_OFF_T > 4, since it's only used by Curl_write64_le.

- Include <arpa/inet.h> in socketpair.c.

Closes https://github.com/curl/curl/pull/4756

lib/curl_endian.c
lib/curl_setup_once.h
lib/socketpair.c

index b7563b3ded74be033948edb8965113af477e60d0..a774d136e493b9b1000344efedc777ce130c70df 100644 (file)
@@ -81,6 +81,7 @@ unsigned short Curl_read16_be(const unsigned char *buf)
                           ((unsigned short)buf[1]));
 }
 
+#if (CURL_SIZEOF_CURL_OFF_T > 4)
 /*
  * write32_le()
  *
@@ -100,7 +101,6 @@ static void write32_le(const int value, unsigned char *buffer)
   buffer[3] = (char)((value & 0xFF000000) >> 24);
 }
 
-#if (CURL_SIZEOF_CURL_OFF_T > 4)
 /*
  * Curl_write64_le()
  *
index 8db74e9b46583f80b20327762bcce865eca97329..8890f3890dfd73241cea06a879d41a2751d59683 100644 (file)
@@ -374,6 +374,7 @@ typedef int sig_atomic_t;
  * Macro used to include assertion code only in debug builds.
  */
 
+#undef DEBUGASSERT
 #if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H)
 #define DEBUGASSERT(x) assert(x)
 #else
index 1f0e2e4a4f0e46c3bb03e63329d83a188ac1ebff..1ec0d75a468c384f801a614d91fe18d6e5c6fec1 100644 (file)
@@ -40,6 +40,9 @@
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h> /* IPPROTO_TCP */
 #endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
 #ifndef INADDR_LOOPBACK
 #define INADDR_LOOPBACK 0x7f000001
 #endif /* !INADDR_LOOPBACK */