diff options
author | ShadowNinja <shadowninja@minetest.net> | 2014-09-11 13:42:21 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-09-21 14:39:35 -0400 |
commit | cd64a92a8cde573404e8af9e220d4e1c6ce6453e (patch) | |
tree | 749a56c1e6a5c46d05910297ae75d08372677480 /src/util | |
parent | b97c9c65777b0389f4cc9a6e3257506f29761e03 (diff) | |
download | minetest-cd64a92a8cde573404e8af9e220d4e1c6ce6453e.tar.gz minetest-cd64a92a8cde573404e8af9e220d4e1c6ce6453e.tar.bz2 minetest-cd64a92a8cde573404e8af9e220d4e1c6ce6453e.zip |
Use const references for Settings methods
Also check for (this == &other) before locking mutexes.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/string.cpp | 4 | ||||
-rw-r--r-- | src/util/string.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp index 363a15e65..92a4735c4 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -191,7 +191,7 @@ std::string urldecode(std::string str) return oss.str(); } -u32 readFlagString(std::string str, FlagDesc *flagdesc, u32 *flagmask) +u32 readFlagString(std::string str, const FlagDesc *flagdesc, u32 *flagmask) { u32 result = 0, mask = 0; char *s = &str[0]; @@ -225,7 +225,7 @@ u32 readFlagString(std::string str, FlagDesc *flagdesc, u32 *flagmask) return result; } -std::string writeFlagString(u32 flags, FlagDesc *flagdesc, u32 flagmask) +std::string writeFlagString(u32 flags, const FlagDesc *flagdesc, u32 flagmask) { std::string result; diff --git a/src/util/string.h b/src/util/string.h index 6e2db0af4..98d23b161 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -334,8 +334,8 @@ inline bool is_number(const std::string& tocheck) std::string translatePassword(std::string playername, std::wstring password); std::string urlencode(std::string str); std::string urldecode(std::string str); -u32 readFlagString(std::string str, FlagDesc *flagdesc, u32 *flagmask); -std::string writeFlagString(u32 flags, FlagDesc *flagdesc, u32 flagmask); +u32 readFlagString(std::string str, const FlagDesc *flagdesc, u32 *flagmask); +std::string writeFlagString(u32 flags, const FlagDesc *flagdesc, u32 flagmask); size_t mystrlcpy(char *dst, const char *src, size_t size); char *mystrtok_r(char *s, const char *sep, char **lasts); u64 read_seed(const char *str); |