| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5630c8c commit 1506384
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -573,30 +573,30 @@ static inline int NormalizePort(std::string scheme, int p) { | |||
| 573 | 573 | } | |
| 574 | 574 | ||
| 575 | 575 | #if defined(NODE_HAVE_I18N_SUPPORT) | |
| 576 | - static inline bool ToUnicode(std::string* input, std::string* output) { | ||
| 576 | + static inline bool ToUnicode(const std::string& input, std::string* output) { | ||
| 577 | 577 | MaybeStackBuffer<char> buf; | |
| 578 | - if (i18n::ToUnicode(&buf, input->c_str(), input->length()) < 0) | ||
| 578 | + if (i18n::ToUnicode(&buf, input.c_str(), input.length()) < 0) | ||
| 579 | 579 | return false; | |
| 580 | 580 | output->assign(*buf, buf.length()); | |
| 581 | 581 | return true; | |
| 582 | 582 | } | |
| 583 | 583 | ||
| 584 | - static inline bool ToASCII(std::string* input, std::string* output) { | ||
| 584 | + static inline bool ToASCII(const std::string& input, std::string* output) { | ||
| 585 | 585 | MaybeStackBuffer<char> buf; | |
| 586 | - if (i18n::ToASCII(&buf, input->c_str(), input->length()) < 0) | ||
| 586 | + if (i18n::ToASCII(&buf, input.c_str(), input.length()) < 0) | ||
| 587 | 587 | return false; | |
| 588 | 588 | output->assign(*buf, buf.length()); | |
| 589 | 589 | return true; | |
| 590 | 590 | } | |
| 591 | 591 | #else | |
| 592 | 592 | // Intentional non-ops if ICU is not present. | |
| 593 | - static inline bool ToUnicode(std::string* input, std::string* output) { | ||
| 594 | - *output = *input; | ||
| 593 | + static inline bool ToUnicode(const std::string& input, std::string* output) { | ||
| 594 | + *output = input; | ||
| 595 | 595 | return true; | |
| 596 | 596 | } | |
| 597 | 597 | ||
| 598 | - static inline bool ToASCII(std::string* input, std::string* output) { | ||
| 599 | - *output = *input; | ||
| 598 | + static inline bool ToASCII(const std::string& input, std::string* output) { | ||
| 599 | + *output = input; | ||
| 600 | 600 | return true; | |
| 601 | 601 | } | |
| 602 | 602 | #endif | |
@@ -864,7 +864,7 @@ static url_host_type ParseHost(url_host* host, | |||
| 864 | 864 | PercentDecode(input, length, &decoded); | |
| 865 | 865 | ||
| 866 | 866 | // Then we have to punycode toASCII | |
| 867 | - if (!ToASCII(&decoded, &decoded)) | ||
| 867 | + if (!ToASCII(decoded, &decoded)) | ||
| 868 | 868 | goto end; | |
| 869 | 869 | ||
| 870 | 870 | // If any of the following characters are still present, we have to fail | |
@@ -881,7 +881,7 @@ static url_host_type ParseHost(url_host* host, | |||
| 881 | 881 | goto end; | |
| 882 | 882 | ||
| 883 | 883 | // If the unicode flag is set, run the result through punycode ToUnicode | |
| 884 | - if (unicode && !ToUnicode(&decoded, &decoded)) | ||
| 884 | + if (unicode && !ToUnicode(decoded, &decoded)) | ||
| 885 | 885 | goto end; | |
| 886 | 886 | ||
| 887 | 887 | // It's not an IPv4 or IPv6 address, it must be a domain | |
@@ -2124,7 +2124,7 @@ std::string URL::ToFilePath() const { | |||
| 2124 | 2124 | if ((context_.flags & URL_FLAGS_HAS_HOST) && | |
| 2125 | 2125 | context_.host.length() > 0) { | |
| 2126 | 2126 | std::string unicode_host; | |
| 2127 | - if (!ToUnicode(&context_.host, &unicode_host)) { | ||
| 2127 | + if (!ToUnicode(context_.host, &unicode_host)) { | ||
| 2128 | 2128 | return ""; | |
| 2129 | 2129 | } | |
| 2130 | 2130 | return "\\\\" + unicode_host + decoded_path; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments