From 880e2607bb9fbd02d3d9bea00bf75e738664fd8c Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 12 Dec 2024 13:02:28 -0500 Subject: [PATCH] fix warnings --- include/ada/url_pattern-inl.h | 10 +++++----- include/ada/url_pattern.h | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/ada/url_pattern-inl.h b/include/ada/url_pattern-inl.h index 4f8f3f67c..107c0ae9a 100644 --- a/include/ada/url_pattern-inl.h +++ b/include/ada/url_pattern-inl.h @@ -313,7 +313,7 @@ inline std::string_view constructor_string_parser::make_component_string() { const auto end_index = token.index; // Return the code point substring from component start input index to end // index within parser’s input. - return input.substr(component_start_input_index, end_index); + return std::string_view(input).substr(component_start_input_index, end_index); } inline bool constructor_string_parser::is_an_identity_terminator() { @@ -360,9 +360,9 @@ inline void Tokenizer::get_next_code_point() { next_index++; } -inline void Tokenizer::seek_and_get_next_code_point(size_t index) { +inline void Tokenizer::seek_and_get_next_code_point(size_t new_index) { // Set tokenizer’s next index to index. - next_index = index; + next_index = new_index; // Run get the next code point given tokenizer. get_next_code_point(); } @@ -405,13 +405,13 @@ Tokenizer::process_tokenizing_error(size_t next_position, } // @see https://urlpattern.spec.whatwg.org/#is-a-valid-name-code-point -inline bool Tokenizer::is_valid_name_code_point(char code_point, bool first) { +inline bool Tokenizer::is_valid_name_code_point(char cp, bool first) { // If first is true return the result of checking if code point is contained // in the IdentifierStart set of code points. Otherwise return the result of // checking if code point is contained in the IdentifierPart set of code // points. // TODO: Implement this - (void)code_point; + (void)cp; (void)first; return true; } diff --git a/include/ada/url_pattern.h b/include/ada/url_pattern.h index 2b63ac7c7..a6610206a 100644 --- a/include/ada/url_pattern.h +++ b/include/ada/url_pattern.h @@ -148,9 +148,9 @@ struct url_pattern_part { struct url_pattern_compile_component_options { url_pattern_compile_component_options() = default; explicit url_pattern_compile_component_options( - std::optional delimiter = std::nullopt, - std::optional prefix = std::nullopt) - : delimiter(delimiter), prefix(prefix){}; + std::optional new_delimiter = std::nullopt, + std::optional new_prefix = std::nullopt) + : delimiter(new_delimiter), prefix(new_prefix){}; // @see https://urlpattern.spec.whatwg.org/#options-delimiter-code-point std::optional delimiter{}; @@ -170,13 +170,13 @@ class url_pattern_component { // This function explicitly takes a std::string because it is moved. // To avoid unnecessary copy, move each value while calling the constructor. - url_pattern_component(std::string pattern, std::string regexp, - std::vector group_name_list, - bool has_regexp_groups) - : pattern(std::move(pattern)), - regexp(std::move(regexp)), - group_name_list(std::move(group_name_list)), - has_regexp_groups_(has_regexp_groups){}; + url_pattern_component(std::string new_pattern, std::string new_regexp, + std::vector new_group_name_list, + bool new_has_regexp_groups) + : pattern(std::move(new_pattern)), + regexp(std::move(new_regexp)), + group_name_list(std::move(new_group_name_list)), + has_regexp_groups_(new_has_regexp_groups){}; // @see https://urlpattern.spec.whatwg.org/#compile-a-component template @@ -338,7 +338,7 @@ struct Token { // @see https://urlpattern.spec.whatwg.org/#tokenizer class Tokenizer { -public: + public: explicit Tokenizer(std::string_view input, token_policy policy) : input(input), policy(policy) {}