This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 8761cc9bfc3bc3905c0d0c4e3932b38e71e84226
Author: chao an <anc...@xiaomi.com>
AuthorDate: Wed Feb 8 13:58:23 2023 +0800

    libs: fix visual studio Compiler Error C2036
    
    D:\code\nuttx\libs\libc\net\lib_inetpton.c(300,52): error C2036: "void *" : 
unknown size
    
    Reference:
    
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2036?view=msvc-170
    
    Signed-off-by: chao an <anc...@xiaomi.com>
---
 include/nuttx/net/netdev.h   | 3 ++-
 libs/libc/net/lib_inetpton.c | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h
index 33a4f8c7da..cb6d69d58c 100644
--- a/include/nuttx/net/netdev.h
+++ b/include/nuttx/net/netdev.h
@@ -162,7 +162,8 @@
  */
 
 #define IPBUF(hl) ((FAR void *)(IOB_DATA(dev->d_iob) + (hl)))
-#define NETLLBUF  (IPBUF(0) - NET_LL_HDRLEN(dev))
+#define NETLLBUF  ((FAR void *) \
+                   ((FAR uint8_t *)IPBUF(0) - NET_LL_HDRLEN(dev)))
 
 #define IPv4BUF ((FAR struct ipv4_hdr_s *)IPBUF(0))
 #define IPv6BUF ((FAR struct ipv6_hdr_s *)IPBUF(0))
diff --git a/libs/libc/net/lib_inetpton.c b/libs/libc/net/lib_inetpton.c
index f1636fcf61..724759dcd9 100644
--- a/libs/libc/net/lib_inetpton.c
+++ b/libs/libc/net/lib_inetpton.c
@@ -107,7 +107,7 @@ static int inet_ipv4_pton(FAR const char *src, FAR void 
*dest)
 
   memset(dest, 0, sizeof(struct in_addr));
 
-  ip        = (uint8_t *)dest;
+  ip        = (FAR uint8_t *)dest;
   srcoffset = 0;
   numoffset = 0;
   ndots     = 0;
@@ -297,7 +297,8 @@ static int inet_ipv6_pton(FAR const char *src, FAR void 
*dest)
 
               if (nrsep > 0)
                 {
-                  memcpy(dest + (16 - (nrsep << 1)), &rip[0], nrsep << 1);
+                  memcpy((FAR uint8_t *)dest +
+                         (16 - (nrsep << 1)), &rip[0], nrsep << 1);
                 }
 
               /* Return 1 if the conversion succeeds */

Reply via email to