From e572fac401f73657298b16fdc3b68edfbcaabb3a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 15 Mar 2013 08:10:34 -0700 Subject: [PATCH] Minor warning fixes. --- gfx/gl_lost_manager.cpp | 2 +- gfx/texture_gen.cpp | 2 ++ image/zim_load.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gfx/gl_lost_manager.cpp b/gfx/gl_lost_manager.cpp index 1c2ed98262..92d273706b 100644 --- a/gfx/gl_lost_manager.cpp +++ b/gfx/gl_lost_manager.cpp @@ -46,7 +46,7 @@ void gl_lost() { } ILOG("gl_lost() restoring %i items:", (int)holders->size()); for (size_t i = 0; i < holders->size(); i++) { - ILOG("GLLost(%i, %p)", i, holders->size(), (*holders)[i]); + ILOG("GLLost(%i / %i, %p)", (int) i, (int) holders->size(), (*holders)[i]); (*holders)[i]->GLLost(); } ILOG("gl_lost() completed restoring %i items:", (int)holders->size()); diff --git a/gfx/texture_gen.cpp b/gfx/texture_gen.cpp index 3a8209933d..673126de72 100644 --- a/gfx/texture_gen.cpp +++ b/gfx/texture_gen.cpp @@ -47,6 +47,8 @@ uint8_t *generateTexture(const char *filename, int &bpp, int &w, int &h, bool &c data[y*w + x] = val * 255; } } + } else { + data = NULL; } return data; diff --git a/image/zim_load.cpp b/image/zim_load.cpp index 6980e7b8bd..16162e4a9f 100644 --- a/image/zim_load.cpp +++ b/image/zim_load.cpp @@ -100,6 +100,12 @@ int LoadZIMPtr(uint8_t *zim, int datasize, int *width, int *height, int *flags, total_data_size += image_data_size[i]; } + if (total_data_size == 0) + { + ELOG("Invalid ZIM data size 0"); + return 0; + } + image[0] = (uint8 *)malloc(total_data_size); for (int i = 1; i < num_levels; i++) { image[i] = image[i-1] + image_data_size[i-1];