deps: update ada to 2.7.8

PR-URL: https://github.com/nodejs/node/pull/52517
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
Node.js GitHub Bot authored and Richard Lau committed 2024-05-16 14:43:34 +00:00
1 parent e4ea2db58b
commit af3e32073b
2 files changed
+108 -45

No files matched your search

+52 -21
View File
@@ -1,4 +1,4 @@
/* auto-generated on 2024-03-07 13:23:39 -0500. Do not edit! */
/* auto-generated on 2024-04-11 16:39:11 -0400. Do not edit! */
/* begin file src/ada.cpp */
#include "ada.h"
/* begin file src/checkers.cpp */
@@ -11585,7 +11585,7 @@ ada_really_inline bool url::parse_scheme(const std::string_view input) {
}
}
} else { // slow path
std::string _buffer = std::string(input);
std::string _buffer(input);
// Next function is only valid if the input is ASCII and returns false
// otherwise, but it seems that we always have ascii content so we do not
// need to check the return value.
@@ -13227,7 +13227,7 @@ template <bool has_state_override>
}
}
} else { // slow path
std::string _buffer = std::string(input);
std::string _buffer(input);
// Next function is only valid if the input is ASCII and returns false
// otherwise, but it seems that we always have ascii content so we do not
// need to check the return value.
@@ -13683,7 +13683,7 @@ bool url_aggregator::set_host_or_hostname(const std::string_view input) {
return false;
}
std::string previous_host = std::string(get_hostname());
std::string previous_host(get_hostname());
uint32_t previous_port = components.port;
size_t host_end_pos = input.find('#');
@@ -14983,7 +14983,7 @@ bool ada_can_parse(const char* input, size_t length) noexcept {
bool ada_can_parse_with_base(const char* input, size_t input_length,
const char* base, size_t base_length) noexcept {
auto base_view = std::string_view(base, base_length);
std::string_view base_view(base, base_length);
return ada::can_parse(std::string_view(input, input_length), &base_view);
}
@@ -15388,14 +15388,18 @@ ada_owned_string ada_search_params_to_string(ada_url_search_params result) {
size_t ada_search_params_size(ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) return 0;
if (!r) {
return 0;
}
return r->size();
}
void ada_search_params_sort(ada_url_search_params result) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (r) r->sort();
if (r) {
r->sort();
}
}
void ada_search_params_append(ada_url_search_params result, const char* key,
@@ -15444,7 +15448,9 @@ bool ada_search_params_has(ada_url_search_params result, const char* key,
size_t key_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) return false;
if (!r) {
return false;
}
return r->has(std::string_view(key, key_length));
}
@@ -15453,7 +15459,9 @@ bool ada_search_params_has_value(ada_url_search_params result, const char* key,
size_t value_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) return false;
if (!r) {
return false;
}
return r->has(std::string_view(key, key_length),
std::string_view(value, value_length));
}
@@ -15462,9 +15470,13 @@ ada_string ada_search_params_get(ada_url_search_params result, const char* key,
size_t key_length) {
ada::result<ada::url_search_params>& r =
*(ada::result<ada::url_search_params>*)result;
if (!r) return ada_string_create(NULL, 0);
if (!r) {
return ada_string_create(NULL, 0);
}
auto found = r->get(std::string_view(key, key_length));
if (!found.has_value()) return ada_string_create(NULL, 0);
if (!found.has_value()) {
return ada_string_create(NULL, 0);
}
return ada_string_create(found->data(), found->length());
}
@@ -15522,14 +15534,18 @@ void ada_free_strings(ada_strings result) {
size_t ada_strings_size(ada_strings result) {
ada::result<std::vector<std::string>>* r =
(ada::result<std::vector<std::string>>*)result;
if (!r) return 0;
if (!r) {
return 0;
}
return (*r)->size();
}
ada_string ada_strings_get(ada_strings result, size_t index) {
ada::result<std::vector<std::string>>* r =
(ada::result<std::vector<std::string>>*)result;
if (!r) return ada_string_create(NULL, 0);
if (!r) {
return ada_string_create(NULL, 0);
}
std::string_view view = (*r)->at(index);
return ada_string_create(view.data(), view.length());
}
@@ -15544,9 +15560,13 @@ ada_string ada_search_params_keys_iter_next(
ada_url_search_params_keys_iter result) {
ada::result<ada::url_search_params_keys_iter>* r =
(ada::result<ada::url_search_params_keys_iter>*)result;
if (!r) return ada_string_create(NULL, 0);
if (!r) {
return ada_string_create(NULL, 0);
}
auto next = (*r)->next();
if (!next.has_value()) return ada_string_create(NULL, 0);
if (!next.has_value()) {
return ada_string_create(NULL, 0);
}
return ada_string_create(next->data(), next->length());
}
@@ -15554,7 +15574,9 @@ bool ada_search_params_keys_iter_has_next(
ada_url_search_params_keys_iter result) {
ada::result<ada::url_search_params_keys_iter>* r =
(ada::result<ada::url_search_params_keys_iter>*)result;
if (!r) return false;
if (!r) {
return false;
}
return (*r)->has_next();
}
@@ -15569,9 +15591,13 @@ ada_string ada_search_params_values_iter_next(
ada_url_search_params_values_iter result) {
ada::result<ada::url_search_params_values_iter>* r =
(ada::result<ada::url_search_params_values_iter>*)result;
if (!r) return ada_string_create(NULL, 0);
if (!r) {
return ada_string_create(NULL, 0);
}
auto next = (*r)->next();
if (!next.has_value()) return ada_string_create(NULL, 0);
if (!next.has_value()) {
return ada_string_create(NULL, 0);
}
return ada_string_create(next->data(), next->length());
}
@@ -15579,7 +15605,9 @@ bool ada_search_params_values_iter_has_next(
ada_url_search_params_values_iter result) {
ada::result<ada::url_search_params_values_iter>* r =
(ada::result<ada::url_search_params_values_iter>*)result;
if (!r) return false;
if (!r) {
return false;
}
return (*r)->has_next();
}
@@ -15596,8 +15624,9 @@ ada_string_pair ada_search_params_entries_iter_next(
(ada::result<ada::url_search_params_entries_iter>*)result;
if (!r) return {ada_string_create(NULL, 0), ada_string_create(NULL, 0)};
auto next = (*r)->next();
if (!next.has_value())
if (!next.has_value()) {
return {ada_string_create(NULL, 0), ada_string_create(NULL, 0)};
}
return ada_string_pair{
ada_string_create(next->first.data(), next->first.length()),
ada_string_create(next->second.data(), next->second.length())};
@@ -15607,7 +15636,9 @@ bool ada_search_params_entries_iter_has_next(
ada_url_search_params_entries_iter result) {
ada::result<ada::url_search_params_entries_iter>* r =
(ada::result<ada::url_search_params_entries_iter>*)result;
if (!r) return false;
if (!r) {
return false;
}
return (*r)->has_next();
}
+56 -24
View File
@@ -1,4 +1,4 @@
/* auto-generated on 2024-03-07 13:23:39 -0500. Do not edit! */
/* auto-generated on 2024-04-11 16:39:11 -0400. Do not edit! */
/* begin file include/ada.h */
/**
* @file ada.h
@@ -461,9 +461,11 @@ namespace ada {
#ifdef ADA_VISUAL_STUDIO
#define ADA_ASSUME(COND) __assume(COND)
#else
#define ADA_ASSUME(COND) \
do { \
if (!(COND)) __builtin_unreachable(); \
#define ADA_ASSUME(COND) \
do { \
if (!(COND)) { \
__builtin_unreachable(); \
} \
} while (0)
#endif
@@ -948,15 +950,15 @@ constexpr uint8_t WWW_FORM_URLENCODED_PERCENT_ENCODE[32] = {
// 30 31 32 33 34 35 36 37
0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
// 38 39 3A 3B 3C 3D 3E 3F
0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x80,
0x00 | 0x00 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
// 40 41 42 43 44 45 46 47
0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
// 48 49 4A 4B 4C 4D 4E 4F
0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
// 50 51 52 53 54 55 56 57
0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
// 58 59 5A 5B 5C 5D 5E 5F
0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
0x00 | 0x00 | 0x00 | 0x08 | 0x00 | 0x20 | 0x40 | 0x00,
// 60 61 62 63 64 65 66 67
0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
// 68 69 6A 6B 6C 6D 6E 6F
@@ -964,7 +966,7 @@ constexpr uint8_t WWW_FORM_URLENCODED_PERCENT_ENCODE[32] = {
// 70 71 72 73 74 75 76 77
0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
// 78 79 7A 7B 7C 7D 7E 7F
0x00 | 0x00 | 0x00 | 0x08 | 0x00 | 0x20 | 0x40 | 0x80,
0x00 | 0x00 | 0x00 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
// 80 81 82 83 84 85 86 87
0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
// 88 89 8A 8B 8C 8D 8E 8F
@@ -1072,7 +1074,7 @@ ada_really_inline bool begins_with(std::string_view view,
} // namespace ada::checkers
#endif // ADA_CHECKERS_H
#endif // ADA_CHECKERS_INL_H
/* end file include/ada/checkers-inl.h */
/* begin file include/ada/log.h */
/**
@@ -4349,6 +4351,30 @@ constexpr std::string_view is_special_list[] = {"http", " ", "https", "ws",
constexpr uint16_t special_ports[] = {80, 0, 443, 80, 21, 443, 0, 0};
} // namespace details
/****
* @private
* In is_special, get_scheme_type, and get_special_port, we
* use a standard hashing technique to find the index of the scheme in
* the is_special_list. The hashing technique is based on the size of
* the scheme and the first character of the scheme. It ensures that we
* do at most one string comparison per call. If the protocol is
* predictible (e.g., it is always "http"), we can get a better average
* performance by using a simpler approach where we loop and compare
* scheme with all possible protocols starting with the most likely
* protocol. Doing multiple comparisons may have a poor worst case
* performance, however. In this instance, we choose a potentially
* slightly lower best-case performance for a better worst-case
* performance. We can revisit this choice at any time.
*
* Reference:
* Schmidt, Douglas C. "Gperf: A perfect hash function generator."
* More C++ gems 17 (2000).
*
* Reference: https://en.wikipedia.org/wiki/Perfect_hash_function
*
* Reference: https://github.com/ada-url/ada/issues/617
****/
ada_really_inline constexpr bool is_special(std::string_view scheme) {
if (scheme.empty()) {
return false;
@@ -5642,7 +5668,7 @@ inline std::ostream &operator<<(std::ostream &out, const ada::url &u) {
if (query.has_value()) {
out.search_start = uint32_t(running_index);
running_index += get_search().size();
if (get_search().size() == 0) {
if (get_search().empty()) {
running_index++;
}
}
@@ -6113,7 +6139,7 @@ inline void url_aggregator::append_base_pathname(const std::string_view input) {
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
#if ADA_DEVELOPMENT_CHECKS
// computing the expected password.
std::string path_expected = std::string(get_pathname());
std::string path_expected(get_pathname());
path_expected.append(input);
#endif // ADA_DEVELOPMENT_CHECKS
uint32_t ending_index = uint32_t(buffer.size());
@@ -6183,7 +6209,7 @@ inline void url_aggregator::append_base_username(const std::string_view input) {
ADA_ASSERT_TRUE(!helpers::overlaps(input, buffer));
#if ADA_DEVELOPMENT_CHECKS
// computing the expected password.
std::string username_expected = std::string(get_username());
std::string username_expected(get_username());
username_expected.append(input);
#endif // ADA_DEVELOPMENT_CHECKS
add_authority_slashes_if_needed();
@@ -6213,7 +6239,7 @@ inline void url_aggregator::append_base_username(const std::string_view input) {
components.hash_start += difference;
}
#if ADA_DEVELOPMENT_CHECKS
std::string username_after = std::string(get_username());
std::string username_after(get_username());
ADA_ASSERT_EQUAL(
username_expected, username_after,
"append_base_username problem after inserting " + std::string(input));
@@ -6339,7 +6365,7 @@ inline void url_aggregator::append_base_password(const std::string_view input) {
components.hash_start += difference;
}
#if ADA_DEVELOPMENT_CHECKS
std::string password_after = std::string(get_password());
std::string password_after(get_password());
ADA_ASSERT_EQUAL(
password_expected, password_after,
"append_base_password problem after inserting " + std::string(input));
@@ -6826,7 +6852,7 @@ struct url_search_params {
/**
* @see https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
*/
inline std::string to_string();
inline std::string to_string() const;
/**
* Returns a simple JS-style iterator over all of the keys in this
@@ -6943,12 +6969,12 @@ inline void url_search_params::initialize(std::string_view input) {
auto equal = current.find('=');
if (equal == std::string_view::npos) {
auto name = std::string(current);
std::string name(current);
std::replace(name.begin(), name.end(), '+', ' ');
params.emplace_back(unicode::percent_decode(name, name.find('%')), "");
} else {
auto name = std::string(current.substr(0, equal));
auto value = std::string(current.substr(equal + 1));
std::string name(current.substr(0, equal));
std::string value(current.substr(equal + 1));
std::replace(name.begin(), name.end(), '+', ' ');
std::replace(value.begin(), value.end(), '+', ' ');
@@ -7021,7 +7047,7 @@ inline bool url_search_params::has(std::string_view key,
return entry != params.end();
}
inline std::string url_search_params::to_string() {
inline std::string url_search_params::to_string() const {
auto character_set = ada::character_sets::WWW_FORM_URLENCODED_PERCENT_ENCODE;
std::string out{};
for (size_t i = 0; i < params.size(); i++) {
@@ -7106,20 +7132,26 @@ inline bool url_search_params_iter<T, Type>::has_next() {
template <>
inline std::optional<std::string_view> url_search_params_keys_iter::next() {
if (!has_next()) return std::nullopt;
if (!has_next()) {
return std::nullopt;
}
return params.params[pos++].first;
}
template <>
inline std::optional<std::string_view> url_search_params_values_iter::next() {
if (!has_next()) return std::nullopt;
if (!has_next()) {
return std::nullopt;
}
return params.params[pos++].second;
}
template <>
inline std::optional<key_value_view_pair>
url_search_params_entries_iter::next() {
if (!has_next()) return std::nullopt;
if (!has_next()) {
return std::nullopt;
}
return params.params[pos++];
}
@@ -7137,14 +7169,14 @@ url_search_params_entries_iter::next() {
#ifndef ADA_ADA_VERSION_H
#define ADA_ADA_VERSION_H
#define ADA_VERSION "2.7.7"
#define ADA_VERSION "2.7.8"
namespace ada {
enum {
ADA_VERSION_MAJOR = 2,
ADA_VERSION_MINOR = 7,
ADA_VERSION_REVISION = 7,
ADA_VERSION_REVISION = 8,
};
} // namespace ada