code cleanup from cppcheck

This commit is contained in:
Mark Vejvoda 2013-06-20 22:51:28 +00:00
parent 511ba5134f
commit 4848e957e7
3 changed files with 3 additions and 4 deletions

View File

@ -412,7 +412,7 @@ void GraphicListBox::setItems(const vector<string> &items, const vector<string>
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;

View File

@ -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 != "") {

View File

@ -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");