summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-01 15:14:16 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-01 23:42:37 +0300
commitf9030497b6196ce2fadb6b6ada5d784be227d9a6 (patch)
treed11408b35d0860709d31e6520578cdd28391f151
parentf52ca7838789a6910840597a929ecf6e0be9e1de (diff)
downloadmanaverse-f9030497b6196ce2fadb6b6ada5d784be227d9a6.tar.gz
manaverse-f9030497b6196ce2fadb6b6ada5d784be227d9a6.tar.bz2
manaverse-f9030497b6196ce2fadb6b6ada5d784be227d9a6.tar.xz
manaverse-f9030497b6196ce2fadb6b6ada5d784be227d9a6.zip
Add missing const.
-rw-r--r--src/actormanager.h4
-rw-r--r--src/animationdelayload.h2
-rw-r--r--src/avatar.h4
-rw-r--r--src/being/actorsprite.cpp2
-rw-r--r--src/being/actorsprite.h2
-rw-r--r--src/being/being.h8
-rw-r--r--src/being/beingcacheentry.h2
-rw-r--r--src/client.cpp2
-rw-r--r--src/client.h2
-rw-r--r--src/gui/widgets/button.h2
-rw-r--r--src/gui/windows/socialwindow.cpp2
-rw-r--r--src/gui/windows/statuswindow.cpp2
-rw-r--r--src/gui/windows/statuswindow.h2
-rw-r--r--src/maplayer.cpp2
-rw-r--r--src/maplayer.h6
-rw-r--r--src/net/ea/network.cpp2
-rw-r--r--src/net/ea/network.h2
-rw-r--r--src/render/graphics.cpp2
-rw-r--r--src/render/graphics.h2
-rw-r--r--src/render/graphicsdef.hpp2
-rw-r--r--src/render/mobileopenglgraphics.cpp2
-rw-r--r--src/render/normalopenglgraphics.cpp2
-rw-r--r--src/render/nullopenglgraphics.cpp2
-rw-r--r--src/render/safeopenglgraphics.cpp2
-rw-r--r--src/render/sdl2graphics.cpp2
-rw-r--r--src/render/sdl2softwaregraphics.cpp2
-rw-r--r--src/render/sdlgraphics.cpp2
-rw-r--r--src/render/surfacegraphics.h2
-rw-r--r--src/resources/beinginfo.cpp9
-rw-r--r--src/resources/beinginfo.h10
-rw-r--r--src/test/testmain.cpp10
-rw-r--r--src/test/testmain.h10
-rw-r--r--src/textcommand.h8
-rw-r--r--src/tileset.h2
-rw-r--r--src/utils/stringutils.cpp2
-rw-r--r--src/utils/stringutils.h2
-rw-r--r--src/utils/translation/poparser.cpp6
-rw-r--r--src/utils/translation/poparser.h8
38 files changed, 72 insertions, 65 deletions
diff --git a/src/actormanager.h b/src/actormanager.h
index f7e306b2a..df5d7ab38 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -251,10 +251,10 @@ class ActorManager final: public ConfigListener
void addIgnorePickupItem(const std::string &name);
- void setPriorityAttackMobs(std::list<std::string> mobs)
+ void setPriorityAttackMobs(const std::list<std::string> &mobs)
{ mPriorityAttackMobs = mobs; }
- void setAttackMobs(std::list<std::string> mobs)
+ void setAttackMobs(const std::list<std::string> &mobs)
{ mAttackMobs = mobs; }
int getPriorityAttackMobsSize() const A_WARN_UNUSED
diff --git a/src/animationdelayload.h b/src/animationdelayload.h
index 1fd4731ef..6b5216a64 100644
--- a/src/animationdelayload.h
+++ b/src/animationdelayload.h
@@ -41,7 +41,7 @@ class AnimationDelayLoad final
void load();
- void setAction(std::string action)
+ void setAction(const std::string &action)
{ mAction = action; }
private:
diff --git a/src/avatar.h b/src/avatar.h
index 03050a06f..60e68a948 100644
--- a/src/avatar.h
+++ b/src/avatar.h
@@ -115,7 +115,7 @@ public:
std::string getMap() const A_WARN_UNUSED
{ return mMap; }
- void setMap(std::string map)
+ void setMap(const std::string &map)
{ mMap = map; }
int getX() const A_WARN_UNUSED
@@ -169,7 +169,7 @@ public:
const std::string &getIp() const A_WARN_UNUSED
{ return mIp; }
- void setIp(std::string ip)
+ void setIp(const std::string &ip)
{ mIp = ip; }
bool getPoison() const A_WARN_UNUSED
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 29fa1290c..75d337bd5 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -208,7 +208,7 @@ void ActorSprite::updateStatusEffect(const int index, const bool newStatus)
handleStatusEffect(effect, index);
}
-void ActorSprite::handleStatusEffect(StatusEffect *const effect,
+void ActorSprite::handleStatusEffect(const StatusEffect *const effect,
const int effectId)
{
if (!effect)
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 76e90182d..fd90aba09 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -210,7 +210,7 @@ protected:
* \param The StatusEffect to effect
* \param effectId -1 for stun, otherwise the effect index
*/
- virtual void handleStatusEffect(StatusEffect *const effect,
+ virtual void handleStatusEffect(const StatusEffect *const effect,
const int effectId);
void setupSpriteDisplay(const SpriteDisplay &display,
diff --git a/src/being/being.h b/src/being/being.h
index 793454ca2..2a6ec9195 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -474,7 +474,7 @@ class Being : public ActorSprite, public ConfigListener
/**
* Sets the walk speed in pixels per second.
*/
- void setWalkSpeed(Vector speed)
+ void setWalkSpeed(const Vector &speed)
{ mWalkSpeed = speed; mSpeed = speed.x; }
/**
@@ -725,7 +725,7 @@ class Being : public ActorSprite, public ConfigListener
const std::string &getIp() const A_WARN_UNUSED
{ return mIp; }
- void setIp(std::string ip)
+ void setIp(const std::string &ip)
{ mIp = ip; }
unsigned int getPvpRank() const A_WARN_UNUSED
@@ -791,7 +791,7 @@ class Being : public ActorSprite, public ConfigListener
const std::string getComment() const A_WARN_UNUSED
{ return mComment; }
- void setComment(std::string n)
+ void setComment(const std::string &n)
{ mComment = n; }
static void clearCache();
@@ -829,7 +829,7 @@ class Being : public ActorSprite, public ConfigListener
void updatePercentHP();
- void setRaceName(std::string name)
+ void setRaceName(const std::string &name)
{ mRaceName = name; }
std::string getRaceName() const A_WARN_UNUSED
diff --git a/src/being/beingcacheentry.h b/src/being/beingcacheentry.h
index af60a9090..c2c9aa513 100644
--- a/src/being/beingcacheentry.h
+++ b/src/being/beingcacheentry.h
@@ -97,7 +97,7 @@ class BeingCacheEntry final
std::string getIp() const
{ return mIp; }
- void setIp(std::string ip)
+ void setIp(const std::string &ip)
{ mIp = ip; }
bool isAdvanced() const
diff --git a/src/client.cpp b/src/client.cpp
index ce4cd081b..83147d34c 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2053,7 +2053,7 @@ void Client::initConfigDir()
* Initializes the home directory. On UNIX and FreeBSD, ~/.mana is used. On
* Windows and other systems we use the current working directory.
*/
-void Client::initServerConfig(std::string serverName)
+void Client::initServerConfig(const std::string &serverName)
{
mServerConfigDir = mConfigDir + dirSeparator + serverName;
diff --git a/src/client.h b/src/client.h
index 0d7749e3f..7d83cf789 100644
--- a/src/client.h
+++ b/src/client.h
@@ -368,7 +368,7 @@ private:
void initScreenshotDir();
- void initServerConfig(std::string serverName);
+ void initServerConfig(const std::string &serverName);
static void initFeatures();
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index 015faf009..716ed7728 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -158,7 +158,7 @@ class Button final : public Widget,
void mouseReleased(MouseEvent& event) override final;
- void setDescription(std::string text)
+ void setDescription(const std::string &text)
{ mDescription = text; }
std::string getDescription() const A_WARN_UNUSED
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index 6a17514d6..4e22595a6 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -588,7 +588,7 @@ public:
being->setDamageTaken(0);
}
- Avatar* findAvatarbyName(std::string name)
+ Avatar* findAvatarbyName(const std::string &name)
{
std::vector<Avatar*> *const avatars = mBeings->getMembers();
if (!avatars)
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index f2473241c..a45c206f5 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -706,7 +706,7 @@ std::string StatusWindow::translateLetter(const char *const letters)
return std::string(buf);
}
-std::string StatusWindow::translateLetter2(std::string letters)
+std::string StatusWindow::translateLetter2(const std::string &letters)
{
if (letters.size() < 5)
return "";
diff --git a/src/gui/windows/statuswindow.h b/src/gui/windows/statuswindow.h
index 797e7647f..2beeea586 100644
--- a/src/gui/windows/statuswindow.h
+++ b/src/gui/windows/statuswindow.h
@@ -95,7 +95,7 @@ class StatusWindow final : public Window,
private:
static std::string translateLetter(const char *const letters);
- static std::string translateLetter2(std::string letters);
+ static std::string translateLetter2(const std::string &letters);
/**
* Status Part
diff --git a/src/maplayer.cpp b/src/maplayer.cpp
index 2db140d67..7db90b956 100644
--- a/src/maplayer.cpp
+++ b/src/maplayer.cpp
@@ -850,7 +850,7 @@ ObjectsLayer::~ObjectsLayer()
mTiles = nullptr;
}
-void ObjectsLayer::addObject(std::string name, const int type,
+void ObjectsLayer::addObject(const std::string &name, const int type,
const unsigned x, const unsigned y,
unsigned dx, unsigned dy)
{
diff --git a/src/maplayer.h b/src/maplayer.h
index 88db82214..ad2378010 100644
--- a/src/maplayer.h
+++ b/src/maplayer.h
@@ -283,13 +283,13 @@ class MapItem final
const std::string &getComment() const A_WARN_UNUSED
{ return mComment; }
- void setComment(std::string comment)
+ void setComment(const std::string &comment)
{ mComment = comment; }
const std::string &getName() const A_WARN_UNUSED
{ return mName; }
- void setName(std::string name)
+ void setName(const std::string &name)
{ mName = name; }
void draw(Graphics *const graphics, const int x, const int y,
@@ -313,7 +313,7 @@ class ObjectsLayer final
~ObjectsLayer();
- void addObject(std::string name, const int type,
+ void addObject(const std::string &name, const int type,
const unsigned x, const unsigned y,
unsigned dx, unsigned dy);
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index 128ca2996..61a9499d0 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -86,7 +86,7 @@ Network::~Network()
TcpNet::quit();
}
-bool Network::connect(ServerInfo server)
+bool Network::connect(const ServerInfo &server)
{
if (mState != IDLE && mState != NET_ERROR)
{
diff --git a/src/net/ea/network.h b/src/net/ea/network.h
index 08f9d7c71..57102d7e3 100644
--- a/src/net/ea/network.h
+++ b/src/net/ea/network.h
@@ -42,7 +42,7 @@ class Network
virtual ~Network();
- bool connect(ServerInfo server);
+ bool connect(const ServerInfo &server);
void disconnect();
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 5437e6737..24c3ab69e 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -547,7 +547,7 @@ void Graphics::setWindowSize(const int width A_UNUSED,
#endif
}
-bool Graphics::pushClipArea(Rect area)
+bool Graphics::pushClipArea(const Rect &area)
{
// Ignore area with a negate width or height
// by simple pushing an empty clip area
diff --git a/src/render/graphics.h b/src/render/graphics.h
index 541bb789d..ce612193c 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -419,7 +419,7 @@ class Graphics
* @return False if the the new area lays outside the current clip
* area.
*/
- virtual bool pushClipArea(Rect area);
+ virtual bool pushClipArea(const Rect &area);
/**
* Removes the top most clip area from the stack.
diff --git a/src/render/graphicsdef.hpp b/src/render/graphicsdef.hpp
index b11f88249..29cdc4a0f 100644
--- a/src/render/graphicsdef.hpp
+++ b/src/render/graphicsdef.hpp
@@ -37,7 +37,7 @@ public:
void endDraw();
- bool pushClipArea(Rect area) override final;
+ bool pushClipArea(const Rect &area) override final;
void popClipArea() override final;
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 3db76a616..65b6b291a 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -961,7 +961,7 @@ SDL_Surface* MobileOpenGLGraphics::getScreenshot()
return screenshot;
}
-bool MobileOpenGLGraphics::pushClipArea(Rect area)
+bool MobileOpenGLGraphics::pushClipArea(const Rect &area)
{
int transX = 0;
int transY = 0;
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 8f3659936..bb8eed230 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -1223,7 +1223,7 @@ SDL_Surface* NormalOpenGLGraphics::getScreenshot()
return screenshot;
}
-bool NormalOpenGLGraphics::pushClipArea(Rect area)
+bool NormalOpenGLGraphics::pushClipArea(const Rect &area)
{
int transX = 0;
int transY = 0;
diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp
index 919b43c10..6497a7b5a 100644
--- a/src/render/nullopenglgraphics.cpp
+++ b/src/render/nullopenglgraphics.cpp
@@ -938,7 +938,7 @@ SDL_Surface* NullOpenGLGraphics::getScreenshot()
return nullptr;
}
-bool NullOpenGLGraphics::pushClipArea(Rect area)
+bool NullOpenGLGraphics::pushClipArea(const Rect &area)
{
int transX = 0;
int transY = 0;
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index 177cfecb5..d5c9981a3 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -529,7 +529,7 @@ SDL_Surface* SafeOpenGLGraphics::getScreenshot()
return screenshot;
}
-bool SafeOpenGLGraphics::pushClipArea(Rect area)
+bool SafeOpenGLGraphics::pushClipArea(const Rect &area)
{
int transX = 0;
int transY = 0;
diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp
index 2b70a8ab0..25a689ddf 100644
--- a/src/render/sdl2graphics.cpp
+++ b/src/render/sdl2graphics.cpp
@@ -670,7 +670,7 @@ void SDLGraphics::endDraw()
popClipArea();
}
-bool SDLGraphics::pushClipArea(Rect area)
+bool SDLGraphics::pushClipArea(const Rect &area)
{
const bool result = Graphics::pushClipArea(area);
diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp
index a176b6905..e5943f7c7 100644
--- a/src/render/sdl2softwaregraphics.cpp
+++ b/src/render/sdl2softwaregraphics.cpp
@@ -1125,7 +1125,7 @@ void SDL2SoftwareGraphics::endDraw()
popClipArea();
}
-bool SDL2SoftwareGraphics::pushClipArea(Rect area)
+bool SDL2SoftwareGraphics::pushClipArea(const Rect &area)
{
const bool result = Graphics::pushClipArea(area);
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index ac304b7ab..9b852689d 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -1122,7 +1122,7 @@ void SDLGraphics::endDraw()
popClipArea();
}
-bool SDLGraphics::pushClipArea(Rect area)
+bool SDLGraphics::pushClipArea(const Rect &area)
{
const bool result = Graphics::pushClipArea(area);
const ClipRect &carea = mClipStack.top();
diff --git a/src/render/surfacegraphics.h b/src/render/surfacegraphics.h
index 44c2691ae..ab569acb0 100644
--- a/src/render/surfacegraphics.h
+++ b/src/render/surfacegraphics.h
@@ -63,7 +63,7 @@ class SurfaceGraphics final : public Graphics
void endDraw() override final
{ }
- bool pushClipArea(Rect rect A_UNUSED) override final
+ bool pushClipArea(const Rect &rect A_UNUSED) override final
{ return true; }
void popClipArea() override final
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 8b76d7e2a..d7ecb8136 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -155,9 +155,12 @@ const Attack *BeingInfo::getAttack(const int id) const
return (i == mAttacks.end()) ? empty : (*i).second;
}
-void BeingInfo::addAttack(const int id, std::string action,
- std::string skyAction, std::string waterAction,
- const int effectId, const int hitEffectId,
+void BeingInfo::addAttack(const int id,
+ const std::string &action,
+ const std::string &skyAction,
+ const std::string &waterAction,
+ const int effectId,
+ const int hitEffectId,
const int criticalHitEffectId,
const int missEffectId,
const std::string &missileParticle)
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 31725d218..81a1f749d 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -117,9 +117,13 @@ class BeingInfo final
const SoundInfo &getSound(const ItemSoundEvent event)
const A_WARN_UNUSED;
- void addAttack(const int id, std::string action, std::string skyAttack,
- std::string waterAttack, const int effectId,
- const int hitEffectId, const int criticalHitEffectId,
+ void addAttack(const int id,
+ const std::string &action,
+ const std::string &skyAttack,
+ const std::string &waterAttack,
+ const int effectId,
+ const int hitEffectId,
+ const int criticalHitEffectId,
const int missEffectId,
const std::string &missileParticle);
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
index fbd7588ef..cae4aa3b7 100644
--- a/src/test/testmain.cpp
+++ b/src/test/testmain.cpp
@@ -274,7 +274,7 @@ int TestMain::readValue(const int ver, int def)
return def;
}
-int TestMain::invokeTest(std::string test)
+int TestMain::invokeTest(const std::string &test)
{
mConfig.setValue("opengl", static_cast<int>(RENDER_SOFTWARE));
@@ -292,7 +292,7 @@ int TestMain::invokeTest4()
return ret;
}
-int TestMain::invokeSoftwareRenderTest(std::string test)
+int TestMain::invokeSoftwareRenderTest(const std::string &test)
{
mConfig.setValue("opengl", static_cast<int>(RENDER_SOFTWARE));
mConfig.write();
@@ -301,7 +301,7 @@ int TestMain::invokeSoftwareRenderTest(std::string test)
return ret;
}
-int TestMain::invokeFastOpenGLRenderTest(std::string test)
+int TestMain::invokeFastOpenGLRenderTest(const std::string &test)
{
mConfig.setValue("opengl", static_cast<int>(RENDER_NORMAL_OPENGL));
mConfig.write();
@@ -310,7 +310,7 @@ int TestMain::invokeFastOpenGLRenderTest(std::string test)
return ret;
}
-int TestMain::invokeFastOpenBatchTest(std::string test)
+int TestMain::invokeFastOpenBatchTest(const std::string &test)
{
mConfig.setValue("opengl", static_cast<int>(RENDER_NORMAL_OPENGL));
mConfig.write();
@@ -319,7 +319,7 @@ int TestMain::invokeFastOpenBatchTest(std::string test)
return ret;
}
-int TestMain::invokeSafeOpenGLRenderTest(std::string test)
+int TestMain::invokeSafeOpenGLRenderTest(const std::string &test)
{
mConfig.setValue("opengl", static_cast<int>(RENDER_SAFE_OPENGL));
mConfig.write();
diff --git a/src/test/testmain.h b/src/test/testmain.h
index c46e6a1fc..72411417e 100644
--- a/src/test/testmain.h
+++ b/src/test/testmain.h
@@ -50,7 +50,7 @@ class TestMain final
private:
void initConfig();
- int invokeTest(std::string test);
+ int invokeTest(const std::string &test);
int invokeTest3();
@@ -58,13 +58,13 @@ class TestMain final
int invokeTest7();
- int invokeSoftwareRenderTest(std::string test);
+ int invokeSoftwareRenderTest(const std::string &test);
- int invokeFastOpenGLRenderTest(std::string test);
+ int invokeFastOpenGLRenderTest(const std::string &test);
- int invokeFastOpenBatchTest(std::string test);
+ int invokeFastOpenBatchTest(const std::string &test);
- int invokeSafeOpenGLRenderTest(std::string test);
+ int invokeSafeOpenGLRenderTest(const std::string &test);
void testsMain();
diff --git a/src/textcommand.h b/src/textcommand.h
index 2011e90c2..9c807badc 100644
--- a/src/textcommand.h
+++ b/src/textcommand.h
@@ -125,13 +125,13 @@ class TextCommand final
TextCommandType getCommandType() const A_WARN_UNUSED
{ return mCommandType; }
- void setCommand(std::string command)
+ void setCommand(const std::string &command)
{ mCommand = command; }
- void setComment(std::string comment)
+ void setComment(const std::string &comment)
{ mComment = comment; }
- void setSymbol(std::string symbol)
+ void setSymbol(const std::string &symbol)
{ mSymbol = symbol; }
void setId(const unsigned int id)
@@ -140,7 +140,7 @@ class TextCommand final
void setTargetType(const SpellTarget targetType)
{ mTargetType = targetType; }
- void setIcon(std::string icon)
+ void setIcon(const std::string &icon)
{ mIcon = icon; loadImage(); }
void setMana(const unsigned int mana)
diff --git a/src/tileset.h b/src/tileset.h
index 77140544e..05508658a 100644
--- a/src/tileset.h
+++ b/src/tileset.h
@@ -55,7 +55,7 @@ class Tileset final : public ImageSet
/**
* Set tileset property.
*/
- void setProperties(std::map<std::string, std::string> props)
+ void setProperties(const std::map<std::string, std::string> &props)
{ mProperties = props; }
/**
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index f47f724a8..e7b850510 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -283,7 +283,7 @@ std::string removeSpriteIndex(std::string str)
return str;
}
-const char* getSafeUtf8String(std::string text)
+const char* getSafeUtf8String(const std::string &text)
{
const size_t sz = text.size();
const size_t size = sz + UTF8_MAX_SIZE;
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 7cf924d98..cd04006ef 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -149,7 +149,7 @@ std::string extractNameFromSprite(std::string str) A_WARN_UNUSED;
std::string removeSpriteIndex(std::string str) A_WARN_UNUSED;
-const char* getSafeUtf8String(std::string text) A_WARN_UNUSED;
+const char* getSafeUtf8String(const std::string &text) A_WARN_UNUSED;
void getSafeUtf8String(std::string text, char *const buf);
diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp
index c105bf0da..bcb577f84 100644
--- a/src/utils/translation/poparser.cpp
+++ b/src/utils/translation/poparser.cpp
@@ -42,7 +42,7 @@ PoParser::PoParser() :
{
}
-void PoParser::openFile(std::string name)
+void PoParser::openFile(const std::string &name)
{
const ResourceManager *const resman = ResourceManager::getInstance();
if (!resman)
@@ -228,14 +228,14 @@ PoDict *PoParser::getEmptyDict()
return new PoDict("");
}
-bool PoParser::checkLang(std::string lang)
+bool PoParser::checkLang(const std::string &lang)
{
// check is po file exists
const ResourceManager *const resman = ResourceManager::getInstance();
return resman->exists(getFileName(lang));
}
-std::string PoParser::getFileName(std::string lang)
+std::string PoParser::getFileName(const std::string &lang)
{
// get po file name from lang name
// logger->log("getFileName: translations/%s.po", lang.c_str());
diff --git a/src/utils/translation/poparser.h b/src/utils/translation/poparser.h
index 41598442b..d57dde061 100644
--- a/src/utils/translation/poparser.h
+++ b/src/utils/translation/poparser.h
@@ -39,15 +39,15 @@ class PoParser final
const std::string &restrict fileName = "",
PoDict *restrict const dict = nullptr);
- static bool checkLang(std::string lang);
+ static bool checkLang(const std::string &lang);
static PoDict *getEmptyDict();
private:
- void setLang(std::string lang)
+ void setLang(const std::string &lang)
{ mLang = lang; }
- void openFile(std::string name);
+ void openFile(const std::string &name);
bool readLine();
@@ -57,7 +57,7 @@ class PoParser final
bool checkLine() const;
- static std::string getFileName(std::string lang);
+ static std::string getFileName(const std::string &lang);
PoDict *getDict() const;