Skip to content

Commit 8761cc9

Browse files
anchaoxiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent 4b4cee8 commit 8761cc9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/nuttx/net/netdev.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@
162162
*/
163163

164164
#define IPBUF(hl) ((FAR void *)(IOB_DATA(dev->d_iob) + (hl)))
165-
#define NETLLBUF (IPBUF(0) - NET_LL_HDRLEN(dev))
165+
#define NETLLBUF ((FAR void *) \
166+
((FAR uint8_t *)IPBUF(0) - NET_LL_HDRLEN(dev)))
166167

167168
#define IPv4BUF ((FAR struct ipv4_hdr_s *)IPBUF(0))
168169
#define IPv6BUF ((FAR struct ipv6_hdr_s *)IPBUF(0))

libs/libc/net/lib_inetpton.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int inet_ipv4_pton(FAR const char *src, FAR void *dest)
107107

108108
memset(dest, 0, sizeof(struct in_addr));
109109

110-
ip = (uint8_t *)dest;
110+
ip = (FAR uint8_t *)dest;
111111
srcoffset = 0;
112112
numoffset = 0;
113113
ndots = 0;
@@ -297,7 +297,8 @@ static int inet_ipv6_pton(FAR const char *src, FAR void *dest)
297297

298298
if (nrsep > 0)
299299
{
300-
memcpy(dest + (16 - (nrsep << 1)), &rip[0], nrsep << 1);
300+
memcpy((FAR uint8_t *)dest +
301+
(16 - (nrsep << 1)), &rip[0], nrsep << 1);
301302
}
302303

303304
/* Return 1 if the conversion succeeds */

0 commit comments

Comments
 (0)