changeset 13635:022f1af9e21c

2242 libraries should be more careful casting pointers Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Gordon Ross <gwr@nexenta.com> Approved by: Albert Lee <trisk@nexenta.com>
author Richard Lowe <richlowe@richlowe.net>
date Mon, 16 May 2011 21:37:47 +0000
parents 44267816c977
children 776c3d9cae69
files usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs usr/src/lib/libc_db/common/thread_db.c usr/src/lib/libtsol/common/call_labeld.c usr/src/lib/libtsol/common/labeld.h
diffstat 4 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs	Sun May 15 21:34:10 2011 +0100
+++ b/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs	Mon May 16 21:37:47 2011 +0000
@@ -133,7 +133,7 @@
     newSVnv((NVTYPE) (V / 1000000000.0))
 
 #define	SAVE_FNP(H, F, K) \
-    hv_store(H, K, sizeof (K) - 1, newSViv((IVTYPE) &F), 0)
+    hv_store(H, K, sizeof (K) - 1, newSViv((IVTYPE)(uintptr_t)&F), 0)
 #define	SAVE_STRING(H, S, K, SS) \
     hv_store(H, #K, sizeof (#K) - 1, \
     newSVpvn(S->K, SS ? strlen(S->K) : sizeof(S->K)), 0)
--- a/usr/src/lib/libc_db/common/thread_db.c	Sun May 15 21:34:10 2011 +0100
+++ b/usr/src/lib/libc_db/common/thread_db.c	Mon May 16 21:37:47 2011 +0000
@@ -824,7 +824,8 @@
 		else {
 			for (key = 1; key < numkeys; key++) {
 				destruct32 = destructors32[key];
-				if (destruct32 != (caddr32_t)TSD_UNALLOCATED &&
+				if ((destruct32 !=
+				    (caddr32_t)(uintptr_t)TSD_UNALLOCATED) &&
 				    (*cb)(key, (PFrV)(uintptr_t)destruct32,
 				    cbdata_p))
 					break;
--- a/usr/src/lib/libtsol/common/call_labeld.c	Sun May 15 21:34:10 2011 +0100
+++ b/usr/src/lib/libtsol/common/call_labeld.c	Mon May 16 21:37:47 2011 +0000
@@ -24,8 +24,6 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <door.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -139,14 +137,14 @@
 			if ((doorfd = dup(doorfd)) < 0) {
 				perror("couldn't dup");
 				while (i--)
-				    (void) close(tbc[i]);
+					(void) close(tbc[i]);
 				doorfd = -1;
 				(void) mutex_unlock(&_door_lock);
 				return (NOSERVER);
 			}
 		}
 		while (i--)
-		    (void) close(tbc[i]);
+			(void) close(tbc[i]);
 
 		/*
 		 * mark this door descriptor as close on exec
@@ -193,7 +191,7 @@
 		(void) printf("\t\t id = %llx\n", real_door.di_uniquifier);
 #endif	/* DEBUG */
 		if ((real_door.di_attributes & DOOR_REVOKED) ||
-		    (real_door.di_data != (door_ptr_t)COOKIE)) {
+		    (real_door.di_data != COOKIE)) {
 #ifdef	DEBUG
 			(void) printf("real door revoked\n");
 #endif	/* DEBUG */
@@ -204,8 +202,8 @@
 		}
 	} else {
 		if ((door_info(doorfd, &my_door) < 0) ||
-		    (my_door.di_data != (door_ptr_t)COOKIE) ||
-			(my_door.di_uniquifier != real_door.di_uniquifier)) {
+		    (my_door.di_data != COOKIE) ||
+		    (my_door.di_uniquifier != real_door.di_uniquifier)) {
 			perror("my door door_info");
 			/*
 			 * don't close it - someone else has clobbered fd
--- a/usr/src/lib/libtsol/common/labeld.h	Sun May 15 21:34:10 2011 +0100
+++ b/usr/src/lib/libtsol/common/labeld.h	Mon May 16 21:37:47 2011 +0000
@@ -26,8 +26,6 @@
 #ifndef	_LABELD_H
 #define	_LABELD_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <tsol/label.h>
 #include <sys/tsol/label_macro.h>
@@ -45,7 +43,7 @@
 
 #define	DOOR_PATH	"/var/tsol/doors/"
 #define	DOOR_NAME	"labeld"
-#define	COOKIE		(void *)0x6c616264	/* "labd" */
+#define	COOKIE		0x6c616264ull	/* "labd" */
 
 /*	Op codes */