From 48184679086094cc5d6067de8c31a6823fc71732 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 22 Jan 2010 19:05:02 +0000 Subject: Silenced some more cppcheck warnings. Some of these may seem silly, but the way I figure it the changes are harmless at worst, and making them will make it easier to find real errors in the (still quite long) list of warnings. svn-id: r47443 --- backends/platform/PalmOS/Src/base_mouse.cpp | 7 ++----- backends/platform/psp/powerman.cpp | 4 ++-- backends/platform/wii/osystem_gfx.cpp | 3 +-- backends/platform/wince/CEgui/GUIElement.cpp | 3 +-- backends/platform/wince/CEgui/ItemSwitch.cpp | 3 +-- backends/platform/wince/missing/missing.cpp | 6 ++---- backends/vkeybd/image-map.cpp | 4 ++-- backends/vkeybd/virtual-keyboard.cpp | 4 ++-- engines/kyra/gui_lol.cpp | 2 +- engines/lure/res_struct.cpp | 2 +- engines/m4/assets.cpp | 2 +- engines/m4/woodscript.cpp | 8 ++++---- graphics/video/video_player.cpp | 2 +- 13 files changed, 21 insertions(+), 29 deletions(-) diff --git a/backends/platform/PalmOS/Src/base_mouse.cpp b/backends/platform/PalmOS/Src/base_mouse.cpp index 93a1fd2209..053a0ed3a7 100644 --- a/backends/platform/PalmOS/Src/base_mouse.cpp +++ b/backends/platform/PalmOS/Src/base_mouse.cpp @@ -55,11 +55,8 @@ void OSystem_PalmBase::setMouseCursor(const byte *buf, uint w, uint h, int hotsp _mouseCurState.w = w; _mouseCurState.h = h; - if (_mouseDataP) - free(_mouseDataP); - - if (_mouseBackupP) - free(_mouseBackupP); + free(_mouseDataP); + free(_mouseBackupP); _mouseDataP = (byte *)malloc(w * h); _mouseBackupP = (byte *)malloc(w * h * 2); // if 16bit = *2 diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp index 678f3697fb..89741f3fc9 100644 --- a/backends/platform/psp/powerman.cpp +++ b/backends/platform/psp/powerman.cpp @@ -359,7 +359,7 @@ int PowerManager::suspend() { // Iterate Common::List::iterator i = _suspendList.begin(); - for (; i != _suspendList.end(); i++) { + for (; i != _suspendList.end(); ++i) { (*i)->suspend(); } @@ -402,7 +402,7 @@ int PowerManager::resume() { // Iterate Common::List::iterator i = _suspendList.begin(); - for (; i != _suspendList.end(); i++) { + for (; i != _suspendList.end(); ++i) { (*i)->resume(); } diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 13ad3267bf..f1d3e255e2 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -258,8 +258,7 @@ void OSystem_Wii::initSize(uint width, uint height, } if (update) { - if (_gamePixels) - free(_gamePixels); + free(_gamePixels); tex_format = GFX_TF_PALETTE_RGB565; diff --git a/backends/platform/wince/CEgui/GUIElement.cpp b/backends/platform/wince/CEgui/GUIElement.cpp index a37182e69d..23e7843de1 100644 --- a/backends/platform/wince/CEgui/GUIElement.cpp +++ b/backends/platform/wince/CEgui/GUIElement.cpp @@ -120,8 +120,7 @@ namespace CEGUI { } GUIElement::~GUIElement() { - if (_background) - delete _background; + delete _background; } } diff --git a/backends/platform/wince/CEgui/ItemSwitch.cpp b/backends/platform/wince/CEgui/ItemSwitch.cpp index 445b3bb69b..8e0121f7c4 100644 --- a/backends/platform/wince/CEgui/ItemSwitch.cpp +++ b/backends/platform/wince/CEgui/ItemSwitch.cpp @@ -57,8 +57,7 @@ namespace CEGUI { } ItemSwitch::~ItemSwitch() { - if (_backgroundFalse) - delete _backgroundFalse; + delete _backgroundFalse; } bool ItemSwitch::action(int x, int y, bool pushed) { diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index 2d9765b0f2..532f1d2e89 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -288,8 +288,7 @@ struct dirent* readdir(DIR* dir) { } WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, -1, nameFound, MAX_PATH, NULL, NULL); - if (dir->dd_dir.d_name) - free(dir->dd_dir.d_name); + free(dir->dd_dir.d_name); dir->dd_dir.d_name = strdup(nameFound); dir->dd_dir.d_namlen = strlen(nameFound); @@ -307,8 +306,7 @@ int closedir(DIR* dir) { if (dir->dd_handle) FindClose((HANDLE)dir->dd_handle); - if (dir->dd_dir.d_name) - free(dir->dd_dir.d_name); + free(dir->dd_dir.d_name); free(dir); return 1; } diff --git a/backends/vkeybd/image-map.cpp b/backends/vkeybd/image-map.cpp index b0aa42ba22..36d060e1d4 100644 --- a/backends/vkeybd/image-map.cpp +++ b/backends/vkeybd/image-map.cpp @@ -53,7 +53,7 @@ void ImageMap::removeArea(const String& id) { void ImageMap::removeAllAreas() { HashMap::iterator it; - for (it = _areas.begin(); it != _areas.end(); it++) { + for (it = _areas.begin(); it != _areas.end(); ++it) { delete it->_value; } _areas.clear(); @@ -61,7 +61,7 @@ void ImageMap::removeAllAreas() { String ImageMap::findMapArea(int16 x, int16 y) { HashMap::iterator it; - for (it = _areas.begin(); it != _areas.end(); it++) { + for (it = _areas.begin(); it != _areas.end(); ++it) { if (it->_value->contains(x, y)) return it->_key; } diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index 20709ad89f..ed78f9a67c 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -58,9 +58,9 @@ VirtualKeyboard::~VirtualKeyboard() { void VirtualKeyboard::deleteEvents() { ModeMap::iterator it_m; VKEventMap::iterator it_e; - for (it_m = _modes.begin(); it_m != _modes.end(); it_m++) { + for (it_m = _modes.begin(); it_m != _modes.end(); ++it_m) { VKEventMap *evt = &(it_m->_value.events); - for (it_e = evt->begin(); it_e != evt->end(); it_e++) + for (it_e = evt->begin(); it_e != evt->end(); ++it_e) delete it_e->_value; } } diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 78eebe3c3b..4a409f0107 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -2622,7 +2622,7 @@ int GUI_LoL::getInput() { if (_currentMenu == &_savenameMenu) { _vm->updateInput(); - for (Common::List::const_iterator evt = _vm->_eventList.begin(); evt != _vm->_eventList.end(); evt++) { + for (Common::List::const_iterator evt = _vm->_eventList.begin(); evt != _vm->_eventList.end(); ++evt) { if (evt->event.type == Common::EVENT_KEYDOWN) _keyPressed = evt->event.kbd; } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index fa6c2d1b97..85fc157f85 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -787,7 +787,7 @@ void SequenceDelayList::tick() { debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check start at time %d", g_system->getMillis()); - for (i = begin(); i != end(); i++) { + for (i = begin(); i != end(); ++i) { SequenceDelayData *entry = (*i).get(); debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check %xh at time %d", entry->sequenceOffset, entry->timeoutCtr); diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index 746cc7507d..66a3629fe9 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -221,7 +221,7 @@ void SpriteAsset::loadMadsSpriteAsset(M4Engine *vm, Common::SeekableReadStream* } SpriteAsset::~SpriteAsset() { - for (Common::Array::iterator it = _frames.begin(); it != _frames.end(); it++) { + for (Common::Array::iterator it = _frames.begin(); it != _frames.end(); ++it) { delete (*it).frame; } } diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp index 036f5d101f..1bbc780a89 100644 --- a/engines/m4/woodscript.cpp +++ b/engines/m4/woodscript.cpp @@ -328,7 +328,7 @@ void WoodScript::update() { } } - for (Common::Array::iterator it = _layers.begin(); it != _layers.end(); it++) { + for (Common::Array::iterator it = _layers.begin(); it != _layers.end(); ++it) { Sequence *sequence = *it; // TODO: Use correct clipRect etc. @@ -341,7 +341,7 @@ void WoodScript::update() { // Handle end-of-sequence requests if (_endOfSequenceRequestList.size() > 0) { - for (Common::Array::iterator it = _endOfSequenceRequestList.begin(); it != _endOfSequenceRequestList.end(); it++) { + for (Common::Array::iterator it = _endOfSequenceRequestList.begin(); it != _endOfSequenceRequestList.end(); ++it) { Sequence *sequence = *it; EndOfSequenceRequestItem endOfSequenceRequestItem = sequence->getEndOfSequenceRequestItem(); @@ -354,11 +354,11 @@ void WoodScript::update() { void WoodScript::clear() { - for (Common::Array::iterator it = _sequences.begin(); it != _sequences.end(); it++) + for (Common::Array::iterator it = _sequences.begin(); it != _sequences.end(); ++it) delete *it; _sequences.clear(); - for (Common::Array::iterator it = _machines.begin(); it != _machines.end(); it++) + for (Common::Array::iterator it = _machines.begin(); it != _machines.end(); ++it) delete *it; _machines.clear(); diff --git a/graphics/video/video_player.cpp b/graphics/video/video_player.cpp index a8c4ccba89..ed96ac5fc5 100644 --- a/graphics/video/video_player.cpp +++ b/graphics/video/video_player.cpp @@ -167,7 +167,7 @@ void VideoPlayer::processVideoEvents(Common::List &stopEvents) { _skipVideo = true; } - for (Common::List::const_iterator iter = stopEvents.begin(); iter != stopEvents.end(); iter++) { + for (Common::List::const_iterator iter = stopEvents.begin(); iter != stopEvents.end(); ++iter) { if (curEvent.type == iter->type) { if (iter->type == Common::EVENT_KEYDOWN || iter->type == Common::EVENT_KEYUP) { if (curEvent.kbd.keycode == iter->kbd.keycode) { -- cgit v1.2.3