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){ void GraphicListBox::setSelectedItemIndex(int index, bool errorOnMissing){
if(errorOnMissing == true && (index < 0 || index >= items.size())) { if(errorOnMissing == true && (index < 0 || index >= items.size())) {
char szBuf[8096]=""; 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); throw megaglest_runtime_error(szBuf);
} }
selectedItemIndex= index; selectedItemIndex= index;

View File

@ -38,7 +38,6 @@ const int Logger::logLineCount= 15;
// ===================== PUBLIC ======================== // ===================== PUBLIC ========================
Logger::Logger() { Logger::Logger() {
string containerName = "Logger";
progress = 0; progress = 0;
string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey); string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey);
if(logs_path != "") { if(logs_path != "") {

View File

@ -100,7 +100,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
*p++ = 0; *p++ = 0;
// after file name follows line number // after file name follows line number
strcpy (file , buf); strcpy (file , buf);
sscanf (p,"%d", &line); sscanf (p,"%10d", &line);
} }
else { else {
strcpy (file,"unknown"); strcpy (file,"unknown");
@ -128,7 +128,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
*p++ = 0; *p++ = 0;
// after file name follows line number // after file name follows line number
strcpy (file , buf); strcpy (file , buf);
sscanf (p,"%d", &line); sscanf (p,"%10d", &line);
} }
else { else {
strcpy (file,"unknown"); strcpy (file,"unknown");