Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Dec 12, 2024
1 parent 8618f04 commit 880e260
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions include/ada/url_pattern-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
}
Expand Down
22 changes: 11 additions & 11 deletions include/ada/url_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<char> delimiter = std::nullopt,
std::optional<char> prefix = std::nullopt)
: delimiter(delimiter), prefix(prefix){};
std::optional<char> new_delimiter = std::nullopt,
std::optional<char> new_prefix = std::nullopt)
: delimiter(new_delimiter), prefix(new_prefix){};

// @see https://urlpattern.spec.whatwg.org/#options-delimiter-code-point
std::optional<char> delimiter{};
Expand All @@ -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<std::string> 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<std::string> 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 <url_pattern_encoding_callback F>
Expand Down Expand Up @@ -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) {}

Expand Down

0 comments on commit 880e260

Please sign in to comment.