1- /* auto-generated on 2025-07-16 22:15:14 -0400. Do not edit! */
1+ /* auto-generated on 2025-09-23 12:57:35 -0400. Do not edit! */
22/* begin file src/ada.cpp */
33#include "ada.h"
44/* begin file src/checkers.cpp */
@@ -9511,12 +9511,14 @@ bool is_label_valid(const std::u32string_view label) {
95119511 for (size_t i = 0; i <= last_non_nsm_char; i++) {
95129512 const direction d = find_direction(label[i]);
95139513
9514+ // NOLINTBEGIN(bugprone-assignment-in-if-condition)
95149515 // In an RTL label, if an EN is present, no AN may be present, and vice
95159516 // versa.
95169517 if ((d == direction::EN && ((has_en = true) && has_an)) ||
95179518 (d == direction::AN && ((has_an = true) && has_en))) {
95189519 return false;
95199520 }
9521+ // NOLINTEND(bugprone-assignment-in-if-condition)
95209522
95219523 if (!(d == direction::R || d == direction::AL || d == direction::AN ||
95229524 d == direction::EN || d == direction::ES || d == direction::CS ||
@@ -10908,6 +10910,7 @@ bool percent_encode(const std::string_view input, const uint8_t character_set[],
1090810910 }
1090910911 ada_log("percent_encode appending ", std::distance(input.begin(), pointer),
1091010912 " bytes");
10913+ // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
1091110914 out.append(input.data(), std::distance(input.begin(), pointer));
1091210915 ada_log("percent_encode processing ", std::distance(pointer, input.end()),
1091310916 " bytes");
@@ -10942,6 +10945,7 @@ bool to_ascii(std::optional<std::string>& out, const std::string_view plain,
1094210945std::string percent_encode(const std::string_view input,
1094310946 const uint8_t character_set[], size_t index) {
1094410947 std::string out;
10948+ // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage)
1094510949 out.append(input.data(), index);
1094610950 auto pointer = input.begin() + index;
1094710951 for (; pointer != input.end(); pointer++) {
@@ -12008,6 +12012,7 @@ ada_warn_unused std::string to_string(ada::state state) {
1200812012
1200912013#include <numeric>
1201012014#include <algorithm>
12015+ #include <iterator>
1201112016#include <ranges>
1201212017#include <string>
1201312018#include <string_view>
@@ -12570,6 +12575,7 @@ ada_really_inline void url::parse_path(std::string_view input) {
1257012575 if (has_search()) {
1257112576 answer.append(",\n");
1257212577 answer.append("\t\"query\":\"");
12578+ // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
1257312579 helpers::encode_json(query.value(), back);
1257412580 answer.append("\"");
1257512581 }
@@ -13316,6 +13322,7 @@ result_type parse_url_impl(std::string_view user_input,
1331613322
1331713323 // If c is U+002F (/), then set state to relative slash state.
1331813324 if ((input_position != input_size) &&
13325+ // NOLINTNEXTLINE(bugprone-branch-clone)
1331913326 (url_data[input_position] == '/')) {
1332013327 ada_log(
1332113328 "RELATIVE_SCHEME if c is U+002F (/), then set state to relative "
@@ -13848,6 +13855,7 @@ template url_aggregator parse_url<url_aggregator>(
1384813855/* end file src/parser.cpp */
1384913856/* begin file src/url_components.cpp */
1385013857
13858+ #include <iterator>
1385113859#include <string>
1385213860
1385313861namespace ada {
@@ -13897,6 +13905,7 @@ namespace ada {
1389713905/* end file src/url_components.cpp */
1389813906/* begin file src/url_aggregator.cpp */
1389913907
13908+ #include <iterator>
1390013909#include <ranges>
1390113910#include <string>
1390213911#include <string_view>
@@ -15832,7 +15841,11 @@ tl::expected<std::string, errors> url_pattern_init::process_search(
1583215841 if (value.starts_with("?")) {
1583315842 value.remove_prefix(1);
1583415843 }
15835- ADA_ASSERT_TRUE(!value.starts_with("?"));
15844+ // We cannot assert that the value is no longer starting with a single
15845+ // question mark because technically it can start. The question is whether or
15846+ // not we should remove the first question mark. Ref:
15847+ // https://github.com/ada-url/ada/pull/992 The spec is not clear on this.
15848+
1583615849 // If type is "pattern" then return strippedValue.
1583715850 if (type == process_type::pattern) {
1583815851 return std::string(value);
@@ -16273,7 +16286,10 @@ tl::expected<std::string, errors> canonicalize_search(std::string_view input) {
1627316286 url->set_search(input);
1627416287 if (url->has_search()) {
1627516288 const auto search = url->get_search();
16276- return std::string(search.substr(1));
16289+ if (!search.empty()) {
16290+ return std::string(search.substr(1));
16291+ }
16292+ return "";
1627716293 }
1627816294 return tl::unexpected(errors::type_error);
1627916295}
@@ -16293,7 +16309,10 @@ tl::expected<std::string, errors> canonicalize_hash(std::string_view input) {
1629316309 // Return dummyURL's fragment.
1629416310 if (url->has_hash()) {
1629516311 const auto hash = url->get_hash();
16296- return std::string(hash.substr(1));
16312+ if (!hash.empty()) {
16313+ return std::string(hash.substr(1));
16314+ }
16315+ return "";
1629716316 }
1629816317 return tl::unexpected(errors::type_error);
1629916318}
0 commit comments