mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-02-03 21:52:24 +00:00
Cast pointers to uintptr_t instead of unsigned {long,int}.
On 64bit Windows, pointers are 64bit whereas both unsigned long and unsigned int are 32bit. Using uintptr_t avoids truncation.
This commit is contained in:
parent
9965cd8a53
commit
f2e61275f2
2
misc.c
2
misc.c
@ -853,7 +853,7 @@ void debug_memdump(const void *buf, int len, int L)
|
|||||||
if (L) {
|
if (L) {
|
||||||
int delta;
|
int delta;
|
||||||
debug_printf("\t%d (0x%x) bytes:\n", len, len);
|
debug_printf("\t%d (0x%x) bytes:\n", len, len);
|
||||||
delta = 15 & (unsigned long int) p;
|
delta = 15 & (uintptr_t)p;
|
||||||
p -= delta;
|
p -= delta;
|
||||||
len += delta;
|
len += delta;
|
||||||
}
|
}
|
||||||
|
@ -411,9 +411,9 @@ static int handle_cmp_evtomain(void *av, void *bv)
|
|||||||
struct handle *a = (struct handle *)av;
|
struct handle *a = (struct handle *)av;
|
||||||
struct handle *b = (struct handle *)bv;
|
struct handle *b = (struct handle *)bv;
|
||||||
|
|
||||||
if ((unsigned)a->u.g.ev_to_main < (unsigned)b->u.g.ev_to_main)
|
if ((uintptr_t)a->u.g.ev_to_main < (uintptr_t)b->u.g.ev_to_main)
|
||||||
return -1;
|
return -1;
|
||||||
else if ((unsigned)a->u.g.ev_to_main > (unsigned)b->u.g.ev_to_main)
|
else if ((uintptr_t)a->u.g.ev_to_main > (uintptr_t)b->u.g.ev_to_main)
|
||||||
return +1;
|
return +1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@ -424,9 +424,9 @@ static int handle_find_evtomain(void *av, void *bv)
|
|||||||
HANDLE *a = (HANDLE *)av;
|
HANDLE *a = (HANDLE *)av;
|
||||||
struct handle *b = (struct handle *)bv;
|
struct handle *b = (struct handle *)bv;
|
||||||
|
|
||||||
if ((unsigned)*a < (unsigned)b->u.g.ev_to_main)
|
if ((uintptr_t)*a < (uintptr_t)b->u.g.ev_to_main)
|
||||||
return -1;
|
return -1;
|
||||||
else if ((unsigned)*a > (unsigned)b->u.g.ev_to_main)
|
else if ((uintptr_t)*a > (uintptr_t)b->u.g.ev_to_main)
|
||||||
return +1;
|
return +1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -138,7 +138,7 @@ static int cmpfortree(void *av, void *bv)
|
|||||||
static int cmpforsearch(void *av, void *bv)
|
static int cmpforsearch(void *av, void *bv)
|
||||||
{
|
{
|
||||||
Actual_Socket b = (Actual_Socket) bv;
|
Actual_Socket b = (Actual_Socket) bv;
|
||||||
unsigned long as = (unsigned long) av, bs = (unsigned long) b->s;
|
uintptr_t as = (uintptr_t) av, bs = (uintptr_t) b->s;
|
||||||
if (as < bs)
|
if (as < bs)
|
||||||
return -1;
|
return -1;
|
||||||
if (as > bs)
|
if (as > bs)
|
||||||
|
Loading…
Reference in New Issue
Block a user