Module Name:    src
Committed By:   christos
Date:           Tue Jan 20 01:10:16 UTC 2015

Modified Files:
        src/sys/sys: socket.h

Log Message:
add void casts to CMSG_


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/sys/socket.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/socket.h
diff -u src/sys/sys/socket.h:1.112 src/sys/sys/socket.h:1.113
--- src/sys/sys/socket.h:1.112	Mon Jan 19 20:02:25 2015
+++ src/sys/sys/socket.h	Mon Jan 19 20:10:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.h,v 1.112 2015/01/20 01:02:25 christos Exp $	*/
+/*	$NetBSD: socket.h,v 1.113 2015/01/20 01:10:16 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -528,10 +528,11 @@ struct cmsghdr {
 
 /* given pointer to struct cmsghdr, return pointer to data */
 #define	CMSG_DATA(cmsg) \
-	((u_char *)(void *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr)))
+    ((void *)((u_char *)(void *)(cmsg) + \
+    __CMSG_ALIGN(sizeof(struct cmsghdr))))
 #define	CCMSG_DATA(cmsg) \
-	((const u_char *)(const void *)(cmsg) + \
-	__CMSG_ALIGN(sizeof(struct cmsghdr)))
+    ((const void *)((const u_char *)(const void *)(cmsg) + \
+    __CMSG_ALIGN(sizeof(struct cmsghdr))))
 
 /*
  * Alignment requirement for CMSG struct manipulation.
@@ -549,11 +550,11 @@ struct cmsghdr {
 
 /* given pointer to struct cmsghdr, return pointer to next cmsghdr */
 #define	CMSG_NXTHDR(mhdr, cmsg)	\
-	(((char *)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \
+	(((char *)(void *)(cmsg) + __CMSG_ALIGN((cmsg)->cmsg_len) + \
 			    __CMSG_ALIGN(sizeof(struct cmsghdr)) > \
-	    (((char *)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ? \
+	    (((char *)(void *)(mhdr)->msg_control) + (mhdr)->msg_controllen)) ?\
 	    (struct cmsghdr *)0 : \
-	    (struct cmsghdr *)(void *)((char *)(cmsg) + \
+	    (struct cmsghdr *)(void *)((char *)(void *)(cmsg) + \
 	        __CMSG_ALIGN((cmsg)->cmsg_len)))
 
 /*
@@ -562,7 +563,7 @@ struct cmsghdr {
  */
 #define	CMSG_FIRSTHDR(mhdr) \
 	((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
-	 (struct cmsghdr *)(mhdr)->msg_control : \
+	 (struct cmsghdr *)(void *)(mhdr)->msg_control : \
 	 (struct cmsghdr *)0)
 
 #define CMSG_SPACE(l)	(__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(l))

Reply via email to