diff options
author | Egor Pugin <egor.pugin@gmail.com> | 2020-03-13 13:45:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-13 13:45:37 +0300 |
commit | dee88d3099607d6fa49e2775aaa8a6cb2d77d710 (patch) | |
tree | 74e5daa9a58f3a97b417925a212ac2cd31487a5e /src/tools/StringTools.cpp | |
parent | d1c6a8062577f5ce58105afff2d0a1887bfff957 (diff) | |
parent | 26fac5bf7e87dd5704a967ee4c744228b93d20b7 (diff) |
Merge pull request #129 from reo7sp/fix/use_proper_types
fix: use C++ fixed-width types instead of C types
Diffstat (limited to 'src/tools/StringTools.cpp')
-rw-r--r-- | src/tools/StringTools.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tools/StringTools.cpp b/src/tools/StringTools.cpp index 2d2e24c..1246c50 100644 --- a/src/tools/StringTools.cpp +++ b/src/tools/StringTools.cpp @@ -54,11 +54,11 @@ void split(const string& str, char delimiter, vector<string>& dest) { } } -string generateRandomString(size_t length) { +string generateRandomString(std::size_t length) { static const string chars("qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890-=[]\\;',./!@#$%^&*()_+{}|:\"<>?`~"); - static const size_t charsLen = chars.length(); + static const std::size_t charsLen = chars.length(); string result; - for (size_t i = 0; i < length; ++i) { + for (std::size_t i = 0; i < length; ++i) { result += chars[rand() % charsLen]; } return result; @@ -81,7 +81,7 @@ string urlEncode(const string& value, const std::string& additionalLegitChars) { string urlDecode(const string& value) { string result; - for (size_t i = 0, count = value.length(); i < count; ++i) { + for (std::size_t i = 0, count = value.length(); i < count; ++i) { const char c = value[i]; if (c == '%') { int t = 0; |