]> granicus.if.org Git - strace/commitdiff
ioctl: use uintptr_t for casts between 32-bit integers and pointers
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 21 Dec 2016 00:26:06 +0000 (00:26 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 21 Dec 2016 22:25:30 +0000 (22:25 +0000)
* ioctl.c (compare): Cast pointer to uintptr_t before assigning
it to an integer.
(ioctl_lookup): Cast integer to uintptr_t before passing it
as a pointer.

ioctl.c

diff --git a/ioctl.c b/ioctl.c
index e4fd59cb736b6d6b18dae7f53bb27c24899a7d6a..126513fca67742e7340228d1e7df240c86c01235 100644 (file)
--- a/ioctl.c
+++ b/ioctl.c
@@ -42,7 +42,7 @@
 static int
 compare(const void *a, const void *b)
 {
-       const unsigned int code1 = (const unsigned long) a;
+       const unsigned int code1 = (const uintptr_t) a;
        const unsigned int code2 = ((struct_ioctlent *) b)->code;
        return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
 }
@@ -52,7 +52,7 @@ ioctl_lookup(const unsigned int code)
 {
        struct_ioctlent *iop;
 
-       iop = bsearch((const void *) (const unsigned long) code, ioctlent,
+       iop = bsearch((const void *) (const uintptr_t) code, ioctlent,
                        nioctlents, sizeof(ioctlent[0]), compare);
        while (iop > ioctlent) {
                iop--;