diff options
author | Fabian Jahr <fjahr@protonmail.com> | 2024-04-20 17:05:18 +0200 |
---|---|---|
committer | Fabian Jahr <fjahr@protonmail.com> | 2024-04-24 23:26:24 +0200 |
commit | 099fa571511f113e0056d4bc27b3153a42f9dc65 (patch) | |
tree | a890065d426cd98ad8aaec45af18c241e80a3c7b /src/common/url.cpp | |
parent | 8f39aaae417c33490e0e41fb97620eb23ced3d05 (diff) | |
download | bitcoin-099fa571511f113e0056d4bc27b3153a42f9dc65.tar.xz |
scripted-diff: Modernize name of urlDecode function and param
-BEGIN VERIFY SCRIPT-
sed -i 's/urlDecode/UrlDecode/g' $(git grep -l 'urlDecode' ./src)
sed -i 's/urlEncoded/url_encoded/g' $(git grep -l 'urlEncoded' ./src)
-END VERIFY SCRIPT-
Diffstat (limited to 'src/common/url.cpp')
-rw-r--r-- | src/common/url.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/url.cpp b/src/common/url.cpp index d0bf4e0cbe..f27bb2b73f 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -9,22 +9,22 @@ #include <string_view> #include <system_error> -std::string urlDecode(std::string_view urlEncoded) +std::string UrlDecode(std::string_view url_encoded) { std::string res; - res.reserve(urlEncoded.size()); + res.reserve(url_encoded.size()); - for (size_t i = 0; i < urlEncoded.size(); ++i) { - char c = urlEncoded[i]; + for (size_t i = 0; i < url_encoded.size(); ++i) { + char c = url_encoded[i]; // Special handling for percent which should be followed by two hex digits // representing an octet values, see RFC 3986, Section 2.1 Percent-Encoding - if (c == '%' && i + 2 < urlEncoded.size()) { + if (c == '%' && i + 2 < url_encoded.size()) { unsigned int decoded_value{0}; - auto [p, ec] = std::from_chars(urlEncoded.data() + i + 1, urlEncoded.data() + i + 3, decoded_value, 16); + auto [p, ec] = std::from_chars(url_encoded.data() + i + 1, url_encoded.data() + i + 3, decoded_value, 16); // Only if there is no error and the pointer is set to the end of // the string, we can be sure both characters were valid hex - if (ec == std::errc{} && p == urlEncoded.data() + i + 3) { + if (ec == std::errc{} && p == url_encoded.data() + i + 3) { // A null character terminates the string if (decoded_value == 0) { return res; |