|
1 |
| -/* auto-generated on 2023-09-19 15:58:51 -0400. Do not edit! */ |
| 1 | +/* auto-generated on 2024-09-03 10:55:13 -0400. Do not edit! */ |
2 | 2 | /* begin file src/idna.cpp */
|
3 | 3 | /* begin file src/unicode_transcoding.cpp */
|
4 | 4 |
|
@@ -9387,22 +9387,6 @@ bool is_label_valid(const std::u32string_view label) {
|
9387 | 9387 |
|
9388 | 9388 | namespace ada::idna {
|
9389 | 9389 |
|
9390 |
| -bool begins_with(std::u32string_view view, std::u32string_view prefix) { |
9391 |
| - if (view.size() < prefix.size()) { |
9392 |
| - return false; |
9393 |
| - } |
9394 |
| - // constexpr as of C++20 |
9395 |
| - return std::equal(prefix.begin(), prefix.end(), view.begin()); |
9396 |
| -} |
9397 |
| - |
9398 |
| -bool begins_with(std::string_view view, std::string_view prefix) { |
9399 |
| - if (view.size() < prefix.size()) { |
9400 |
| - return false; |
9401 |
| - } |
9402 |
| - // constexpr as of C++20 |
9403 |
| - return std::equal(prefix.begin(), prefix.end(), view.begin()); |
9404 |
| -} |
9405 |
| - |
9406 | 9390 | bool constexpr is_ascii(std::u32string_view view) {
|
9407 | 9391 | for (uint32_t c : view) {
|
9408 | 9392 | if (c >= 0x80) {
|
@@ -9465,7 +9449,7 @@ static std::string from_ascii_to_ascii(std::string_view ut8_string) {
|
9465 | 9449 | label_start += label_size_with_dot;
|
9466 | 9450 | if (label_size == 0) {
|
9467 | 9451 | // empty label? Nothing to do.
|
9468 |
| - } else if (begins_with(label_view, "xn--")) { |
| 9452 | + } else if (label_view.starts_with("xn--")) { |
9469 | 9453 | // The xn-- part is the expensive game.
|
9470 | 9454 | out.append(label_view);
|
9471 | 9455 | std::string_view puny_segment_ascii(
|
@@ -9532,7 +9516,7 @@ std::string to_ascii(std::string_view ut8_string) {
|
9532 | 9516 | label_start += label_size_with_dot;
|
9533 | 9517 | if (label_size == 0) {
|
9534 | 9518 | // empty label? Nothing to do.
|
9535 |
| - } else if (begins_with(label_view, U"xn--")) { |
| 9519 | + } else if (label_view.starts_with(U"xn--")) { |
9536 | 9520 | // we do not need to check, e.g., Xn-- because mapping goes to lower case
|
9537 | 9521 | for (char32_t c : label_view) {
|
9538 | 9522 | if (c >= 0x80) {
|
@@ -9611,8 +9595,7 @@ std::string to_unicode(std::string_view input) {
|
9611 | 9595 | is_last_label ? input.size() - label_start : loc_dot - label_start;
|
9612 | 9596 | auto label_view = std::string_view(input.data() + label_start, label_size);
|
9613 | 9597 |
|
9614 |
| - if (ada::idna::begins_with(label_view, "xn--") && |
9615 |
| - ada::idna::is_ascii(label_view)) { |
| 9598 | + if (label_view.starts_with("xn--") && ada::idna::is_ascii(label_view)) { |
9616 | 9599 | label_view.remove_prefix(4);
|
9617 | 9600 | if (ada::idna::verify_punycode(label_view)) {
|
9618 | 9601 | std::u32string tmp_buffer;
|
|
0 commit comments