summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-16 19:28:16 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-16 19:28:16 +0300
commitcd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96 (patch)
treefdda7e2c3d93b35771f6eb79c22dce9301082f19 /src/resources
parentf8fc3380197c078a6dcff02351d835c3022411e1 (diff)
downloadManaVerse-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.tar.gz
ManaVerse-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.tar.bz2
ManaVerse-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.tar.xz
ManaVerse-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.zip
Add const to variables with type size_t.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/dye.cpp9
-rw-r--r--src/resources/resourcemanager.cpp6
-rw-r--r--src/resources/spritedef.cpp4
3 files changed, 10 insertions, 9 deletions
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 4cedafd4e..4b5c1268c 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -282,10 +282,11 @@ Dye::Dye(const std::string &description)
if (description.empty())
return;
- size_t next_pos = 0, length = description.length();
+ size_t next_pos = 0;
+ const size_t length = description.length();
do
{
- size_t pos = next_pos;
+ const size_t pos = next_pos;
next_pos = description.find(';', pos);
if (next_pos == std::string::npos)
@@ -367,7 +368,7 @@ void Dye::instantiate(std::string &target, const std::string &palettes)
size_t last_pos = target.length(), pal_pos = 0;
do
{
- size_t pos = next_pos;
+ const size_t pos = next_pos;
next_pos = target.find(';', pos);
if (next_pos == std::string::npos)
@@ -375,7 +376,7 @@ void Dye::instantiate(std::string &target, const std::string &palettes)
if (next_pos == pos + 1 && pal_pos != std::string::npos)
{
- size_t pal_next_pos = palettes.find(';', pal_pos);
+ const size_t pal_next_pos = palettes.find(';', pal_pos);
s << target[pos] << ':';
if (pal_next_pos == std::string::npos)
{
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 2e6a381fa..d6e66ff7e 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -263,7 +263,7 @@ void ResourceManager::searchAndAddArchives(const std::string &path,
for (char **i = list; *i; i++)
{
- size_t len = strlen(*i);
+ const size_t len = strlen(*i);
if (len > ext.length() && !ext.compare((*i) + (len - ext.length())))
{
@@ -288,7 +288,7 @@ void ResourceManager::searchAndRemoveArchives(const std::string &path,
for (char **i = list; *i; i++)
{
- size_t len = strlen(*i);
+ const size_t len = strlen(*i);
if (len > ext.length() && !ext.compare((*i) + (len - ext.length())))
{
@@ -481,7 +481,7 @@ struct DyedImageLoader
return nullptr;
std::string path = rl->path;
- size_t p = path.find('|');
+ const size_t p = path.find('|');
Dye *d = nullptr;
if (p != std::string::npos)
{
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index f54a332a7..9e8e2cc90 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -76,7 +76,7 @@ unsigned SpriteDef::findNumber(const unsigned num) const
SpriteDef *SpriteDef::load(const std::string &animationFile, const int variant)
{
- size_t pos = animationFile.find('|');
+ const size_t pos = animationFile.find('|');
std::string palettes;
if (pos != std::string::npos)
palettes = animationFile.substr(pos + 1);
@@ -334,7 +334,7 @@ void SpriteDef::loadAnimation(const XmlNodePtr animationNode,
it != it_end; ++ it)
{
std::string str = *it;
- size_t idx = str.find("-");
+ const size_t idx = str.find("-");
if (str == "p")
{
animation->addPause(delay, rand);