From d10afb17486f87a56baf97a893b4e4533eb5b851 Mon Sep 17 00:00:00 2001 From: Ashok Bhat Date: Thu, 14 Nov 2013 11:13:41 +0000 Subject: Pixelflinger: Fix issue of pointers being stored in ints Pixelflinger's code makes assumptions, at certain places, that pointers can be stored as ints. This patch makes use of uintptr_t wherever pointers are stored as int or cast to int. Change-Id: Ie76f425cbc82ac038a747f77a95bd31774f4a8e8 Signed-off-by: Ashok Bhat --- libpixelflinger/buffer.cpp | 2 +- libpixelflinger/codeflinger/ARMAssembler.cpp | 6 +++--- libpixelflinger/scanline.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'libpixelflinger') diff --git a/libpixelflinger/buffer.cpp b/libpixelflinger/buffer.cpp index af7356b..cbdab5a 100644 --- a/libpixelflinger/buffer.cpp +++ b/libpixelflinger/buffer.cpp @@ -93,7 +93,7 @@ void ggl_pick_texture(context_t* c) gen.width = s.width; gen.height = s.height; gen.stride = s.stride; - gen.data = int32_t(s.data); + gen.data = uintptr_t(s.data); } } diff --git a/libpixelflinger/codeflinger/ARMAssembler.cpp b/libpixelflinger/codeflinger/ARMAssembler.cpp index 607ed3c..92243da 100644 --- a/libpixelflinger/codeflinger/ARMAssembler.cpp +++ b/libpixelflinger/codeflinger/ARMAssembler.cpp @@ -99,8 +99,8 @@ void ARMAssembler::disassemble(const char* name) if (comment >= 0) { printf("; %s\n", mComments.valueAt(comment)); } - printf("%08x: %08x ", int(i), int(i[0])); - ::disassemble((u_int)i); + printf("%08x: %08x ", uintptr_t(i), int(i[0])); + ::disassemble((uintptr_t)i); i++; } } @@ -186,7 +186,7 @@ int ARMAssembler::generate(const char* name) #if defined(WITH_LIB_HARDWARE) if (__builtin_expect(mQemuTracing, 0)) { - int err = qemu_add_mapping(int(base()), name); + int err = qemu_add_mapping(uintptr_t(base()), name); mQemuTracing = (err >= 0); } #endif diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp index 9663a2b..96a71f3 100644 --- a/libpixelflinger/scanline.cpp +++ b/libpixelflinger/scanline.cpp @@ -1717,7 +1717,7 @@ void init_y(context_t* c, int32_t ys) gen.width = t.surface.width; gen.height = t.surface.height; gen.stride = t.surface.stride; - gen.data = int32_t(t.surface.data); + gen.data = uintptr_t(t.surface.data); gen.dsdx = ti.dsdx; gen.dtdx = ti.dtdx; } @@ -2125,7 +2125,7 @@ void scanline_t32cb16(context_t* c) int sR, sG, sB; uint32_t s, d; - if (ct==1 || uint32_t(dst)&2) { + if (ct==1 || uintptr_t(dst)&2) { last_one: s = GGL_RGBA_TO_HOST( *src++ ); *dst++ = convertAbgr8888ToRgb565(s); -- cgit v1.1