From 21069ec1635bd24ab33805e033d28f2c0b2de482 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Feb 2016 21:20:59 +0300 Subject: Add missing const in utils directory. --- src/utils/files.cpp | 8 ++++---- src/utils/stringutils.cpp | 4 ++-- src/utils/xml_unittest.cc | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') 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 = "" + const char *const xml = "" "" "this is test"; XML::Document doc(xml, strlen(xml)); @@ -92,7 +92,7 @@ TEST_CASE("xml doc") SECTION("load4") { - const char *xml = "" + const char *const xml = "" "this is test"; XML::Document doc(xml, strlen(xml)); REQUIRE(doc.isLoaded() == true); @@ -191,7 +191,7 @@ TEST_CASE("xml doc") SECTION("child2") { - const char *xml = "" + const char *const xml = "" ""; XML::Document doc(xml, strlen(xml)); -- cgit v1.2.3-70-g09d2