summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-05 21:49:04 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-06 12:12:22 +0300
commit2bd59adc7c456ce6f377feac8bc838e8011ebfc8 (patch)
treef2f25428e42e59b9a6d55d7c0be9a99c42e96e40 /src/utils
parentac1ef6b19f5c1405cfaa239ab367a93b17043723 (diff)
downloadmv-2bd59adc7c456ce6f377feac8bc838e8011ebfc8.tar.gz
mv-2bd59adc7c456ce6f377feac8bc838e8011ebfc8.tar.bz2
mv-2bd59adc7c456ce6f377feac8bc838e8011ebfc8.tar.xz
mv-2bd59adc7c456ce6f377feac8bc838e8011ebfc8.zip
Fix code style.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/files_unittest.cc2
-rw-r--r--src/utils/stringutils.cpp15
-rw-r--r--src/utils/stringutils.h5
-rw-r--r--src/utils/stringutils_unittest.cc6
4 files changed, 14 insertions, 14 deletions
diff --git a/src/utils/files_unittest.cc b/src/utils/files_unittest.cc
index 4adfea8c9..5d227834e 100644
--- a/src/utils/files_unittest.cc
+++ b/src/utils/files_unittest.cc
@@ -34,7 +34,7 @@ TEST_CASE("Files renameFile", "files")
PHYSFS_init("manaplus");
dirSeparator = "/";
logger = new Logger();
- ResourceManager *resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
resman->addToSearchPath("data", false);
resman->addToSearchPath("../data", false);
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index c53d33884..7ad144331 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -23,6 +23,7 @@
#include "utils/stringutils.h"
#include <algorithm>
+#include <sstream>
#ifdef WIN32
#include <sys/time.h>
@@ -716,7 +717,7 @@ std::string toString(unsigned int num)
size_t idx = 28;
do
buf[idx--] = static_cast<char>((num % 10) + '0');
- while(num /= 10);
+ while (num /= 10);
return buf + idx + 1;
}
@@ -727,7 +728,7 @@ std::string toString(unsigned long num)
size_t idx = 98;
do
buf[idx--] = static_cast<char>((num % 10) + '0');
- while(num /= 10);
+ while (num /= 10);
return buf + idx + 1;
}
@@ -738,7 +739,7 @@ std::string toString(uint16_t num)
size_t idx = 8;
do
buf[idx--] = static_cast<char>((num % 10) + '0');
- while(num /= 10);
+ while (num /= 10);
return buf + idx + 1;
}
@@ -749,7 +750,7 @@ std::string toString(unsigned char num)
size_t idx = 3;
do
buf[idx--] = static_cast<char>((num % 10) + '0');
- while(num /= 10);
+ while (num /= 10);
return buf + idx + 1;
}
@@ -767,18 +768,18 @@ std::string toString(int num)
}
do
buf[idx--] = static_cast<char>((num % 10) + '0');
- while(num /= 10);
+ while (num /= 10);
if (useSign)
buf[idx--] = '-';
return buf + idx + 1;
}
-std::string toString(float num)
+std::string toString(const float num)
{
return strprintf("%f", num);
}
-std::string toString(double num)
+std::string toString(const double num)
{
return strprintf("%f", static_cast<float>(num));
}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 738b56cb8..3307d6e73 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -25,7 +25,6 @@
#include "utils/stringvector.h"
-#include <sstream>
#include <list>
#include <set>
@@ -80,9 +79,9 @@ std::string toString(int num);
std::string toString(uint16_t num);
-std::string toString(float num);
+std::string toString(const float num);
-std::string toString(double num);
+std::string toString(const double num);
std::string toStringPrint(const unsigned int val);
diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc
index 4dca829d7..a2c30bb76 100644
--- a/src/utils/stringutils_unittest.cc
+++ b/src/utils/stringutils_unittest.cc
@@ -102,13 +102,13 @@ TEST_CASE("stringuntils atox 1")
atox(str);
str = "";
- int k = atox(str);
+ REQUIRE(0 == atox(str));
str = "0";
- k = atox(str);
+ REQUIRE(0 == atox(str));
str = "0x";
- k = atox(str);
+ REQUIRE(0 == atox(str));
}
TEST_CASE("stringuntils ipToString 1")