diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-05-06 23:11:21 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-05-21 12:27:32 -0600 |
commit | 910ea1476664d8a11d57eaf8ff7f281bcfacd184 (patch) | |
tree | ffed95b63dd38a03b058738f26ad89fb38ed1dfa /src | |
parent | d34dda737ed8af5135c49e269f5ad608cea8d511 (diff) | |
download | mana-client-910ea1476664d8a11d57eaf8ff7f281bcfacd184.tar.gz mana-client-910ea1476664d8a11d57eaf8ff7f281bcfacd184.tar.bz2 mana-client-910ea1476664d8a11d57eaf8ff7f281bcfacd184.tar.xz mana-client-910ea1476664d8a11d57eaf8ff7f281bcfacd184.zip |
Fix some issues found by Cppcheck
Diffstat (limited to 'src')
-rw-r--r-- | src/client.h | 8 | ||||
-rw-r--r-- | src/item.h | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 11 | ||||
-rw-r--r-- | src/particlecontainer.cpp | 9 | ||||
-rw-r--r-- | src/resources/resourcemanager.cpp | 6 |
5 files changed, 22 insertions, 14 deletions
diff --git a/src/client.h b/src/client.h index c120b248..3c52ea37 100644 --- a/src/client.h +++ b/src/client.h @@ -22,17 +22,17 @@ #ifndef CLIENT_H #define CLIENT_H -#include "net/serverinfo.h" - #include "configlistener.h" -#include <guichan/actionlistener.hpp> +#include "net/serverinfo.h" -#include <string> +#include <guichan/actionlistener.hpp> #include <SDL.h> #include <SDL_framerate.h> +#include <string> + class Button; class Desktop; class LoginData; @@ -41,7 +41,7 @@ class Item /** * Destructor. */ - ~Item(); + virtual ~Item(); /** * Sets the item id, identifying the item type. diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 0b0e22f5..b06ea456 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -135,6 +135,9 @@ LocalPlayer::~LocalPlayer() mTargetCursorImages[0][i]->decRef(); mTargetCursorImages[1][i]->decRef(); } + + delete mAwayDialog; + delete mAwayListener; } void LocalPlayer::logic() @@ -1433,10 +1436,8 @@ void LocalPlayer::changeAwayMode() config.getValue("afkMessage", "I am away from keyboard")); mAwayDialog->addActionListener(mAwayListener); } - else - { - mAwayDialog = 0; - } + + mAwayDialog = 0; } void LocalPlayer::setAway(const std::string &message) @@ -1478,4 +1479,4 @@ void AwayListener::action(const gcn::ActionEvent &event) { player_node->changeAwayMode(); } -}
\ No newline at end of file +} diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp index 175c1e87..6900539d 100644 --- a/src/particlecontainer.cpp +++ b/src/particlecontainer.cpp @@ -71,14 +71,17 @@ void ParticleList::addLocally(Particle *particle) void ParticleList::removeLocally(Particle *particle) { - for (std::list<Particle *>::iterator it = mElements.begin(); - it != mElements.end(); it++) + std::list<Particle *>::iterator it, it_end; + for (it = mElements.begin(), it_end = mElements.end(); + it != it_end;) { if (*it == particle) { (*it)->kill(); - mElements.erase(it); + it = mElements.erase(it); } + else + it++; } } diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 24f346f7..f785f20a 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -316,7 +316,11 @@ struct DyedImageLoader } int fileSize; void *buffer = l->manager->loadFile(path, fileSize); - if (!buffer) return NULL; + if (!buffer) + { + delete d; + return NULL; + } Resource *res = d ? Image::load(buffer, fileSize, *d) : Image::load(buffer, fileSize); free(buffer); |