From 4848e957e7dc291f6853740ec67aee168fe0ba2e Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 20 Jun 2013 22:51:28 +0000 Subject: [PATCH] code cleanup from cppcheck --- source/glest_game/facilities/components.cpp | 2 +- source/glest_game/facilities/logger.cpp | 1 - source/shared_lib/sources/platform/sdl/platform_util.cpp | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index 4f286ea3..2bf04056 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -412,7 +412,7 @@ void GraphicListBox::setItems(const vector &items, const vector void GraphicListBox::setSelectedItemIndex(int index, bool errorOnMissing){ if(errorOnMissing == true && (index < 0 || index >= items.size())) { char szBuf[8096]=""; - snprintf(szBuf,8096,"Index not found in listbox name: [%s] value index: %d",this->instanceName.c_str(),index,items.size()); + snprintf(szBuf,8096,"Index not found in listbox name: [%s] value index: %d size: %lu",this->instanceName.c_str(),index,(unsigned long)items.size()); throw megaglest_runtime_error(szBuf); } selectedItemIndex= index; diff --git a/source/glest_game/facilities/logger.cpp b/source/glest_game/facilities/logger.cpp index 8b16a028..5156a7dd 100644 --- a/source/glest_game/facilities/logger.cpp +++ b/source/glest_game/facilities/logger.cpp @@ -38,7 +38,6 @@ const int Logger::logLineCount= 15; // ===================== PUBLIC ======================== Logger::Logger() { - string containerName = "Logger"; progress = 0; string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey); if(logs_path != "") { diff --git a/source/shared_lib/sources/platform/sdl/platform_util.cpp b/source/shared_lib/sources/platform/sdl/platform_util.cpp index 5ebf9e08..ae58caf0 100644 --- a/source/shared_lib/sources/platform/sdl/platform_util.cpp +++ b/source/shared_lib/sources/platform/sdl/platform_util.cpp @@ -100,7 +100,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen *p++ = 0; // after file name follows line number strcpy (file , buf); - sscanf (p,"%d", &line); + sscanf (p,"%10d", &line); } else { strcpy (file,"unknown"); @@ -128,7 +128,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen *p++ = 0; // after file name follows line number strcpy (file , buf); - sscanf (p,"%d", &line); + sscanf (p,"%10d", &line); } else { strcpy (file,"unknown");