mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
net/net_cmsg.c: Fix warning about using void* arithmetics
utils/net_cmsg.c: In function 'cmsg_append':
utils/net_cmsg.c:82:23: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
82 | msg->msg_control += cmsgspace;
| ^~
cc1: all warnings being treated as errors
Using void pointers in arithmetic operations is a GCC extension, it is
not supported by the standard. Because what is the size of a void ?
This commit is contained in:
@@ -79,7 +79,7 @@ FAR void *cmsg_append(FAR struct msghdr *msg, int level, int type,
|
||||
memcpy(cmsgdata, value, value_len);
|
||||
}
|
||||
|
||||
msg->msg_control += cmsgspace;
|
||||
msg->msg_control = (char *)msg->msg_control + cmsgspace;
|
||||
msg->msg_controllen -= cmsgspace;
|
||||
|
||||
return cmsgdata;
|
||||
|
||||
Reference in New Issue
Block a user