mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
Fix dangerous casts
On Windows 64-bit, the size of long is 32-bit, thus any pointer to long cast is not valid. In any case, one should use intptr_t and ptrdiff_t when casting to integers. This commit attempts to fix all instances reported by GCC. When relevant, I replaced code by the macros PTR_ADD, ALIGN_UP from system.h Change-Id: I2273b0e8465d3c4689824717ed5afa5ed238a2dc
This commit is contained in:
parent
1245c5fe61
commit
d7871914ac
27 changed files with 69 additions and 66 deletions
|
|
@ -362,7 +362,7 @@ static void read_compressed_data(SNFILE *fp, byte *start, unsigned size,
|
|||
GET_DATA(ch);
|
||||
if(p + times > end) {
|
||||
put_msg("Warning: Repeat parameter too large in snapshot");
|
||||
times = (int) ((long) end - (long) p);
|
||||
times = (int) ((intptr_t) end - (intptr_t) p);
|
||||
}
|
||||
for(j = 0; j < times; j++) *p++ = ch;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ static struct tzxblock tzxb[NUMBLOCKID] = {
|
|||
};
|
||||
|
||||
|
||||
#define PTRDIFF(pe, ps) ((int) (((long) (pe) - (long) (ps)) / sizeof(*pe)))
|
||||
#define PTRDIFF(pe, ps) pe - ps
|
||||
|
||||
static char tzxheader[] = {'Z','X','T','a','p','e','!',0x1A};
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static byte *a64kmalloc(int num64ksegs)
|
|||
/*exit(1);*/
|
||||
}
|
||||
|
||||
return (byte *) (( (long) bigmem & ~((long) 0xFFFF)) + 0x10000);
|
||||
return (byte *) (( (intptr_t) bigmem & ~((intptr_t) 0xFFFF)) + 0x10000);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue