[Xcb-commit] src

Josh Triplett josh at kemper.freedesktop.org
Tue Nov 21 20:29:46 PST 2006


 src/xcb_auth.c |   12 +++++-------
 src/xcb_conn.c |    2 +-
 src/xcb_util.c |    2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)

New commits:
diff-tree 3de6ab7b786775d9e7df1523c27cdfe3ffd3a25f (from 7fbfebaa3fb3a5ca2d2a307a0a5c40c015e18115)
Author: Josh Triplett <josh at freedesktop.org>
Date:   Tue Nov 21 20:29:34 2006 -0800

    Replace uses of "long" with uint32_t, and similar; fixes 64-bit bugs

diff --git a/src/xcb_auth.c b/src/xcb_auth.c
index 4842d1d..ffc0515 100644
--- a/src/xcb_auth.c
+++ b/src/xcb_auth.c
@@ -192,8 +192,8 @@ static int compute_auth(xcb_auth_info_t 
                 /* XDM-AUTHORIZATION-1 does not handle IPv6 correctly.  Do the
                    same thing Xlib does: use all zeroes for the 4-byte address
                    and 2-byte port number. */
-                long fakeaddr = 0;
-                short fakeport = 0;
+                uint32_t fakeaddr = 0;
+                uint16_t fakeport = 0;
                 APPEND(info->data, j, fakeaddr);
                 APPEND(info->data, j, fakeport);
             }
@@ -201,8 +201,8 @@ static int compute_auth(xcb_auth_info_t 
         break;
         case AF_UNIX:
             /*block*/ {
-	    long fakeaddr = htonl(0xffffffff - next_nonce());
-	    short fakeport = htons(getpid());
+	    uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
+	    uint16_t fakeport = htons(getpid());
 	    APPEND(info->data, j, fakeaddr);
 	    APPEND(info->data, j, fakeport);
 	}
@@ -212,9 +212,7 @@ static int compute_auth(xcb_auth_info_t 
             return 0;   /* do not know how to build this */
 	}
 	{
-	    long now;
-	    time(&now);
-	    now = htonl(now);
+	    uint32_t now = htonl(time(0));
 	    APPEND(info->data, j, now);
 	}
 	assert(j <= 192 / 8);
diff --git a/src/xcb_conn.c b/src/xcb_conn.c
index 239d71b..3b315bc 100644
--- a/src/xcb_conn.c
+++ b/src/xcb_conn.c
@@ -48,7 +48,7 @@ static const int error_connection = 1;
 
 static int set_fd_flags(const int fd)
 {
-    long flags = fcntl(fd, F_GETFL, 0);
+    int flags = fcntl(fd, F_GETFL, 0);
     if(flags == -1)
         return 0;
     flags |= O_NONBLOCK;
diff --git a/src/xcb_util.c b/src/xcb_util.c
index a79296b..bd9f2b5 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -49,7 +49,7 @@ static const int error_connection = 1;
 
 int xcb_popcount(uint32_t mask)
 {
-    unsigned long y;
+    uint32_t y;
     y = (mask >> 1) & 033333333333;
     y = mask - y - ((y >> 1) & 033333333333);
     return ((y + (y >> 3)) & 030707070707) % 077;


More information about the xcb-commit mailing list