diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2016-11-10 02:12:43 +0100 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-11-10 02:12:43 +0100 |
commit | f78a6cb5060298c22a12b1117deb8d1d12d8e129 (patch) | |
tree | d94a38c2109de3c09b9ae632cc9c4a92eabf382d /minui | |
parent | Merge "Touch blocks in care_map in update_verifier" am: 3605a072bc -s ours am: 96c3c32b66 am: b86af2577c (diff) | |
parent | Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap. (diff) | |
download | android_bootable_recovery-f78a6cb5060298c22a12b1117deb8d1d12d8e129.tar android_bootable_recovery-f78a6cb5060298c22a12b1117deb8d1d12d8e129.tar.gz android_bootable_recovery-f78a6cb5060298c22a12b1117deb8d1d12d8e129.tar.bz2 android_bootable_recovery-f78a6cb5060298c22a12b1117deb8d1d12d8e129.tar.lz android_bootable_recovery-f78a6cb5060298c22a12b1117deb8d1d12d8e129.tar.xz android_bootable_recovery-f78a6cb5060298c22a12b1117deb8d1d12d8e129.tar.zst android_bootable_recovery-f78a6cb5060298c22a12b1117deb8d1d12d8e129.zip |
Diffstat (limited to '')
-rw-r--r-- | minui/graphics.cpp | 8 | ||||
-rw-r--r-- | minui/graphics_adf.cpp | 8 | ||||
-rw-r--r-- | minui/graphics_fbdev.cpp | 2 | ||||
-rw-r--r-- | minui/resources.cpp | 8 |
4 files changed, 13 insertions, 13 deletions
diff --git a/minui/graphics.cpp b/minui/graphics.cpp index ab56a6fd6..d5d8d526e 100644 --- a/minui/graphics.cpp +++ b/minui/graphics.cpp @@ -265,7 +265,7 @@ unsigned int gr_get_height(GRSurface* surface) { } int gr_init_font(const char* name, GRFont** dest) { - GRFont* font = reinterpret_cast<GRFont*>(calloc(1, sizeof(*gr_font))); + GRFont* font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font))); if (font == nullptr) { return -1; } @@ -298,14 +298,14 @@ static void gr_init_font(void) // fall back to the compiled-in font. - gr_font = reinterpret_cast<GRFont*>(calloc(1, sizeof(*gr_font))); - gr_font->texture = reinterpret_cast<GRSurface*>(malloc(sizeof(*gr_font->texture))); + gr_font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font))); + gr_font->texture = static_cast<GRSurface*>(malloc(sizeof(*gr_font->texture))); gr_font->texture->width = font.width; gr_font->texture->height = font.height; gr_font->texture->row_bytes = font.width; gr_font->texture->pixel_bytes = 1; - unsigned char* bits = reinterpret_cast<unsigned char*>(malloc(font.width * font.height)); + unsigned char* bits = static_cast<unsigned char*>(malloc(font.width * font.height)); gr_font->texture->data = reinterpret_cast<unsigned char*>(bits); unsigned char data; 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<uint8_t*>(mmap(NULL, - surf->pitch * surf->base.height, PROT_WRITE, - MAP_SHARED, surf->fd, surf->offset)); + surf->base.data = static_cast<uint8_t*>(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<adf_pdata*>(calloc(1, sizeof(*pdata))); + adf_pdata* pdata = static_cast<adf_pdata*>(calloc(1, sizeof(*pdata))); if (!pdata) { perror("allocating adf backend failed"); return NULL; diff --git a/minui/graphics_fbdev.cpp b/minui/graphics_fbdev.cpp index 0788f7552..631ef4e13 100644 --- a/minui/graphics_fbdev.cpp +++ b/minui/graphics_fbdev.cpp @@ -133,7 +133,7 @@ static GRSurface* fbdev_init(minui_backend* backend) { gr_framebuffer[0].height = vi.yres; gr_framebuffer[0].row_bytes = fi.line_length; gr_framebuffer[0].pixel_bytes = vi.bits_per_pixel / 8; - gr_framebuffer[0].data = reinterpret_cast<uint8_t*>(bits); + gr_framebuffer[0].data = static_cast<uint8_t*>(bits); memset(gr_framebuffer[0].data, 0, gr_framebuffer[0].height * gr_framebuffer[0].row_bytes); /* check if we can use double buffering */ diff --git a/minui/resources.cpp b/minui/resources.cpp index 730b05f13..c723476cc 100644 --- a/minui/resources.cpp +++ b/minui/resources.cpp @@ -37,7 +37,7 @@ static GRSurface* malloc_surface(size_t data_size) { size_t size = sizeof(GRSurface) + data_size + SURFACE_DATA_ALIGNMENT; - unsigned char* temp = reinterpret_cast<unsigned char*>(malloc(size)); + unsigned char* temp = static_cast<unsigned char*>(malloc(size)); if (temp == NULL) return NULL; GRSurface* surface = reinterpret_cast<GRSurface*>(temp); surface->data = temp + sizeof(GRSurface) + @@ -221,7 +221,7 @@ int res_create_display_surface(const char* name, GRSurface** pSurface) { png_set_bgr(png_ptr); #endif - p_row = reinterpret_cast<unsigned char*>(malloc(width * 4)); + p_row = static_cast<unsigned char*>(malloc(width * 4)); for (y = 0; y < height; ++y) { png_read_row(png_ptr, p_row, NULL); transform_rgb_to_draw(p_row, surface->data + y * surface->row_bytes, channels, width); @@ -281,7 +281,7 @@ int res_create_multi_display_surface(const char* name, int* frames, int* fps, goto exit; } - surface = reinterpret_cast<GRSurface**>(calloc(*frames, sizeof(GRSurface*))); + surface = static_cast<GRSurface**>(calloc(*frames, sizeof(GRSurface*))); if (surface == NULL) { result = -8; goto exit; @@ -298,7 +298,7 @@ int res_create_multi_display_surface(const char* name, int* frames, int* fps, png_set_bgr(png_ptr); #endif - p_row = reinterpret_cast<unsigned char*>(malloc(width * 4)); + p_row = static_cast<unsigned char*>(malloc(width * 4)); for (y = 0; y < height; ++y) { png_read_row(png_ptr, p_row, NULL); int frame = y % *frames; |