diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/asm/memset16.c | 3 | ||||
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 10 | ||||
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-color-common.c | 2 | ||||
-rw-r--r-- | firmware/kernel/queue.c | 4 | ||||
-rw-r--r-- | firmware/target/hosted/filesystem-win32.c | 2 |
6 files changed, 12 insertions, 11 deletions
diff --git a/firmware/asm/memset16.c b/firmware/asm/memset16.c index db71d86fcc..12f3388a8d 100644 --- a/firmware/asm/memset16.c +++ b/firmware/asm/memset16.c @@ -20,9 +20,10 @@ ****************************************************************************/ #include "string-extra.h" /* memset16() */ +#include <stdint.h> #define LBLOCKSIZE (sizeof(long)/2) -#define ROCKBOX_UNALIGNED(X) ((long)X & (sizeof(long) - 1)) +#define ROCKBOX_UNALIGNED(X) ((uintptr_t)X & (sizeof(long) - 1)) #define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) void memset16(void *dst, int val, size_t len) diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index d006b3900a..a7e80c7244 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c @@ -94,7 +94,7 @@ void lcd_clear_viewport(void) { do { - memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), + memcpy(dst, PTR_ADD(dst, lcd_backdrop_offset), len * sizeof(fb_data)); dst += step; } @@ -122,7 +122,7 @@ static void ICODE_ATTR clearpixel(fb_data *address) static void ICODE_ATTR clearimgpixel(fb_data *address) { - *address = *(fb_data *)((long)address + lcd_backdrop_offset); + *address = *PTR_ADD(address, lcd_backdrop_offset); } static void ICODE_ATTR flippixel(fb_data *address) @@ -244,7 +244,7 @@ void lcd_fillrect(int x, int y, int width, int height) break; case OPT_COPY: - memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), + memcpy(dst, PTR_ADD(dst, lcd_backdrop_offset), len * sizeof(fb_data)); break; @@ -395,7 +395,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, do { if (!(data & 0x01)) - *dst = *(fb_data *)((long)dst + bo); + *dst = *PTR_ADD(dst, bo); dst += ROW_INC; UPDATE_SRC; @@ -435,7 +435,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, do { *dst = (data & 0x01) ? fg - : *(fb_data *)((long)dst + bo); + : *PTR_ADD(dst, bo); dst += ROW_INC; UPDATE_SRC; } diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 3c99560b6d..b792be4e02 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -139,7 +139,7 @@ void lcd_hline(int x1, int x2, int y) break; case OPT_COPY: - memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), + memcpy(dst, PTR_ADD(dst, lcd_backdrop_offset), width * sizeof(fb_data)); break; diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c index b5b0f58eb3..c8bfd2d6b3 100644 --- a/firmware/drivers/lcd-color-common.c +++ b/firmware/drivers/lcd-color-common.c @@ -148,7 +148,7 @@ void lcd_set_backdrop(fb_data* backdrop) lcd_backdrop = backdrop; if (backdrop) { - lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer; + lcd_backdrop_offset = (intptr_t)backdrop - (intptr_t)lcd_framebuffer; lcd_fastpixelfuncs = lcd_fastpixelfuncs_backdrop; } else diff --git a/firmware/kernel/queue.c b/firmware/kernel/queue.c index 233b53c364..5566604c5d 100644 --- a/firmware/kernel/queue.c +++ b/firmware/kernel/queue.c @@ -418,7 +418,7 @@ void queue_post(struct event_queue *q, long id, intptr_t data) wr = q->write++ & QUEUE_LENGTH_MASK; KERNEL_ASSERT((q->write - q->read) <= QUEUE_LENGTH, - "queue_post ovf q=%08lX", (long)q); + "queue_post ovf q=%p", q); q->events[wr].id = id; q->events[wr].data = data; @@ -450,7 +450,7 @@ intptr_t queue_send(struct event_queue *q, long id, intptr_t data) wr = q->write++ & QUEUE_LENGTH_MASK; KERNEL_ASSERT((q->write - q->read) <= QUEUE_LENGTH, - "queue_send ovf q=%08lX", (long)q); + "queue_send ovf q=%p", q); q->events[wr].id = id; q->events[wr].data = data; diff --git a/firmware/target/hosted/filesystem-win32.c b/firmware/target/hosted/filesystem-win32.c index fad9b16e36..be95134cc9 100644 --- a/firmware/target/hosted/filesystem-win32.c +++ b/firmware/target/hosted/filesystem-win32.c @@ -251,7 +251,7 @@ int os_opendirfd(const char *osdirname) else { /* Convert OS handle to fd; the fd now owns it */ - int osfd = _open_osfhandle((long)h, O_RDONLY); + int osfd = _open_osfhandle((intptr_t)h, O_RDONLY); if (osfd >= 0) return osfd; } |