diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-20 21:20:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-20 21:20:59 +0300 |
commit | 21069ec1635bd24ab33805e033d28f2c0b2de482 (patch) | |
tree | faaa3b2cdebc89b0202151b27595864535395585 | |
parent | 65c3c7a8ac6437d507597b840fc20dc1cad5fbf1 (diff) | |
download | manaverse-21069ec1635bd24ab33805e033d28f2c0b2de482.tar.gz manaverse-21069ec1635bd24ab33805e033d28f2c0b2de482.tar.bz2 manaverse-21069ec1635bd24ab33805e033d28f2c0b2de482.tar.xz manaverse-21069ec1635bd24ab33805e033d28f2c0b2de482.zip |
Add missing const in utils directory.
-rw-r--r-- | src/utils/files.cpp | 8 | ||||
-rw-r--r-- | src/utils/stringutils.cpp | 4 | ||||
-rw-r--r-- | src/utils/xml_unittest.cc | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp index 6408a8061..ae56c70da 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -210,7 +210,7 @@ int Files::copyFile(const std::string &restrict srcName, void Files::getFiles(const std::string &path, StringVect &list) { - char **fonts = PhysFs::enumerateFiles(path.c_str()); + char **const fonts = PhysFs::enumerateFiles(path.c_str()); for (char *const *i = fonts; *i; i++) { if (!PhysFs::isDirectory((path + *i).c_str())) @@ -221,7 +221,7 @@ void Files::getFiles(const std::string &path, StringVect &list) void Files::getDirs(const std::string &path, StringVect &list) { - char **fonts = PhysFs::enumerateFiles(path.c_str()); + char **const fonts = PhysFs::enumerateFiles(path.c_str()); for (char *const *i = fonts; *i; i++) { if (PhysFs::isDirectory((path + *i).c_str())) @@ -232,7 +232,7 @@ void Files::getDirs(const std::string &path, StringVect &list) void Files::getFilesWithDir(const std::string &path, StringVect &list) { - char **fonts = PhysFs::enumerateFiles(path.c_str()); + char **const fonts = PhysFs::enumerateFiles(path.c_str()); for (char *const *i = fonts; *i; i++) { if (!PhysFs::isDirectory((path + *i).c_str())) @@ -353,7 +353,7 @@ void Files::saveTextFile(std::string path, void Files::deleteFilesInDirectory(std::string path) { path += "/"; - struct dirent *next_file = nullptr; + const struct dirent *next_file = nullptr; DIR *const dir = opendir(path.c_str()); while ((next_file = readdir(dir))) diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index e7887bc48..b2ac25875 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -601,8 +601,8 @@ std::string stringToHexPath(const std::string &str) return ""; std::string hex = strprintf("%%%2x/", CAST_U32(str[0])); - for (unsigned f = 1, sz = CAST_U32(str.size()); - f < sz; f ++) + for (unsigned f = 1, fsz = CAST_U32(str.size()); + f < fsz; f ++) { hex.append(strprintf("%%%2x", CAST_U32(str[f]))); } diff --git a/src/utils/xml_unittest.cc b/src/utils/xml_unittest.cc index fdee8de5d..e228392a5 100644 --- a/src/utils/xml_unittest.cc +++ b/src/utils/xml_unittest.cc @@ -58,7 +58,7 @@ TEST_CASE("xml doc") SECTION("load2") { - const char *xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + const char *const xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" "<root><data option1=\"false\" option2=\"true\"/>" "<cont>this is test</cont></root>"; XML::Document doc(xml, strlen(xml)); @@ -92,7 +92,7 @@ TEST_CASE("xml doc") SECTION("load4") { - const char *xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + const char *const xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" "<root>this is test</root>"; XML::Document doc(xml, strlen(xml)); REQUIRE(doc.isLoaded() == true); @@ -191,7 +191,7 @@ TEST_CASE("xml doc") SECTION("child2") { - const char *xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + const char *const xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" "<root><data option1=\"false\" option2=\"true\" " "option3=\"10.5\"/></root>"; XML::Document doc(xml, strlen(xml)); |