diff options
| author | Wladimir J. van der Laan <[email protected]> | 2019-01-10 01:46:32 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2019-01-10 02:51:14 +0100 |
| commit | 332b3dd7c156daa08df347dc3359f0ee99ce4baa (patch) | |
| tree | bbd9ee1fdcad37089529f7728774150562e2c0e4 /src/util/strencodings.h | |
| parent | util: remove unused [U](BEGIN|END) macros (diff) | |
| download | discoin-332b3dd7c156daa08df347dc3359f0ee99ce4baa.tar.xz discoin-332b3dd7c156daa08df347dc3359f0ee99ce4baa.zip | |
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.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/strencodings.h b/src/util/strencodings.h index e219e7df3..e392055f2 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); } |