Replace uses of "long" with uint32_t, and similar; fixes 64-bit bugs
This commit is contained in:
parent
7fbfebaa3f
commit
3de6ab7b78
|
@ -192,8 +192,8 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
/* XDM-AUTHORIZATION-1 does not handle IPv6 correctly. Do the
|
/* XDM-AUTHORIZATION-1 does not handle IPv6 correctly. Do the
|
||||||
same thing Xlib does: use all zeroes for the 4-byte address
|
same thing Xlib does: use all zeroes for the 4-byte address
|
||||||
and 2-byte port number. */
|
and 2-byte port number. */
|
||||||
long fakeaddr = 0;
|
uint32_t fakeaddr = 0;
|
||||||
short fakeport = 0;
|
uint16_t fakeport = 0;
|
||||||
APPEND(info->data, j, fakeaddr);
|
APPEND(info->data, j, fakeaddr);
|
||||||
APPEND(info->data, j, fakeport);
|
APPEND(info->data, j, fakeport);
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,8 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
break;
|
break;
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
/*block*/ {
|
/*block*/ {
|
||||||
long fakeaddr = htonl(0xffffffff - next_nonce());
|
uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
|
||||||
short fakeport = htons(getpid());
|
uint16_t fakeport = htons(getpid());
|
||||||
APPEND(info->data, j, fakeaddr);
|
APPEND(info->data, j, fakeaddr);
|
||||||
APPEND(info->data, j, fakeport);
|
APPEND(info->data, j, fakeport);
|
||||||
}
|
}
|
||||||
|
@ -212,9 +212,7 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
return 0; /* do not know how to build this */
|
return 0; /* do not know how to build this */
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
long now;
|
uint32_t now = htonl(time(0));
|
||||||
time(&now);
|
|
||||||
now = htonl(now);
|
|
||||||
APPEND(info->data, j, now);
|
APPEND(info->data, j, now);
|
||||||
}
|
}
|
||||||
assert(j <= 192 / 8);
|
assert(j <= 192 / 8);
|
||||||
|
|
|
@ -48,7 +48,7 @@ static const int error_connection = 1;
|
||||||
|
|
||||||
static int set_fd_flags(const int fd)
|
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)
|
if(flags == -1)
|
||||||
return 0;
|
return 0;
|
||||||
flags |= O_NONBLOCK;
|
flags |= O_NONBLOCK;
|
||||||
|
|
|
@ -49,7 +49,7 @@ static const int error_connection = 1;
|
||||||
|
|
||||||
int xcb_popcount(uint32_t mask)
|
int xcb_popcount(uint32_t mask)
|
||||||
{
|
{
|
||||||
unsigned long y;
|
uint32_t y;
|
||||||
y = (mask >> 1) & 033333333333;
|
y = (mask >> 1) & 033333333333;
|
||||||
y = mask - y - ((y >> 1) & 033333333333);
|
y = mask - y - ((y >> 1) & 033333333333);
|
||||||
return ((y + (y >> 3)) & 030707070707) % 077;
|
return ((y + (y >> 3)) & 030707070707) % 077;
|
||||||
|
|
Loading…
Reference in New Issue