From b29f23f7e7c791e7d8786de93d630a12e4250c71 Mon Sep 17 00:00:00 2001 From: Rahul Chaudhry Date: Wed, 9 Nov 2016 13:17:01 -0800 Subject: Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap. static_cast is preferable to reinterpret_cast when casting from void* pointers returned by malloc/calloc/realloc/mmap calls. Discovered while looking at compiler warnings (b/26936282). Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma Change-Id: Iaffd537784aa857108f6981fdfd82d0496eb5592 Merged-In: I151642d5a60c94f312d0611576ad0143c249ba3d --- minui/graphics_adf.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'minui/graphics_adf.cpp') diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp index 3c3541094..9e262b044 100644 --- a/minui/graphics_adf.cpp +++ b/minui/graphics_adf.cpp @@ -68,9 +68,9 @@ static int adf_surface_init(adf_pdata *pdata, drm_mode_modeinfo *mode, adf_surfa surf->base.row_bytes = surf->pitch; surf->base.pixel_bytes = (pdata->format == DRM_FORMAT_RGB565) ? 2 : 4; - surf->base.data = reinterpret_cast(mmap(NULL, - surf->pitch * surf->base.height, PROT_WRITE, - MAP_SHARED, surf->fd, surf->offset)); + surf->base.data = static_cast(mmap(NULL, + surf->pitch * surf->base.height, PROT_WRITE, + MAP_SHARED, surf->fd, surf->offset)); if (surf->base.data == MAP_FAILED) { close(surf->fd); return -errno; @@ -259,7 +259,7 @@ static void adf_exit(minui_backend *backend) minui_backend *open_adf() { - adf_pdata* pdata = reinterpret_cast(calloc(1, sizeof(*pdata))); + adf_pdata* pdata = static_cast(calloc(1, sizeof(*pdata))); if (!pdata) { perror("allocating adf backend failed"); return NULL; -- cgit v1.2.3