From bce577e663e28e1942fda371235eba091a6ea8e2 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 2 Mar 2012 20:43:10 +0100 Subject: Removed some 'const' keywords from value returns It makes no sense to mark a return value as const when it is returned by value. This only makes sense if the return value is passed by reference, in order to prevent the receiver from modifying the value. Also made some other small adjustments. A std::string does not need to be initialized to "" explicitly and getSafeUtf8String could take its parameter by reference. Reviewed-by: Yohann Ferreira --- src/gui/equipmentwindow.cpp | 2 +- src/gui/equipmentwindow.h | 2 +- src/gui/truetypefont.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 4aa76c2f..85a4c766 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -197,7 +197,7 @@ Item *EquipmentWindow::getItem(int x, int y) const return 0; } -const std::string EquipmentWindow::getSlotName(int x, int y) const +std::string EquipmentWindow::getSlotName(int x, int y) const { for (int i = 0; i < mBoxesNumber; ++i) { diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index 0f1d19fa..29814dc5 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -93,7 +93,7 @@ class EquipmentWindow : public Window, public gcn::ActionListener void mouseMoved(gcn::MouseEvent &event); Item *getItem(int x, int y) const; - const std::string getSlotName(int x, int y) const; + std::string getSlotName(int x, int y) const; void setSelected(int index); diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 5f85ea68..620ba191 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -57,7 +57,7 @@ class TextChunk sdlCol.r = color.r; sdlCol.g = color.g; - const char* str = getSafeUtf8String(text); + const char *str = getSafeUtf8String(text); SDL_Surface *surface = TTF_RenderUTF8_Blended( font, str, sdlCol); delete[] str; @@ -179,7 +179,7 @@ int TrueTypeFont::getWidth(const std::string &text) const } int w, h; - const char* str = getSafeUtf8String(text); + const char *str = getSafeUtf8String(text); TTF_SizeUTF8(mFont, str, &w, &h); delete[] str; return w; -- cgit v1.2.3-70-g09d2