aboutsummaryrefslogtreecommitdiff
path: root/src/util/strencodings.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-01-10 01:46:32 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2019-01-10 02:51:14 +0100
commit332b3dd7c156daa08df347dc3359f0ee99ce4baa (patch)
treebbd9ee1fdcad37089529f7728774150562e2c0e4 /src/util/strencodings.h
parentedb5bb35000e13e001e2693fbff4e8cc9358e166 (diff)
util: Make ToLower and ToUpper take a char
Unfortunately, `std::string` elements are (bare) chars. As these are the most likely type to be passed to these functions, make them use char instead of unsigned char. This avoids some casts.
Diffstat (limited to 'src/util/strencodings.h')
-rw-r--r--src/util/strencodings.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/strencodings.h b/src/util/strencodings.h
index e219e7df31..e392055f27 100644
--- a/src/util/strencodings.h
+++ b/src/util/strencodings.h
@@ -208,7 +208,7 @@ NODISCARD bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32
* @return the lowercase equivalent of c; or the argument
* if no conversion is possible.
*/
-constexpr unsigned char ToLower(unsigned char c)
+constexpr char ToLower(char c)
{
return (c >= 'A' && c <= 'Z' ? (c - 'A') + 'a' : c);
}
@@ -229,7 +229,7 @@ void Downcase(std::string& str);
* @return the uppercase equivalent of c; or the argument
* if no conversion is possible.
*/
-constexpr unsigned char ToUpper(unsigned char c)
+constexpr char ToUpper(char c)
{
return (c >= 'a' && c <= 'z' ? (c - 'a') + 'A' : c);
}