From 010bc697a590886cd748c1f1550d1fd5ef579376 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 12 Dec 2024 16:04:40 -0500 Subject: [PATCH] fix compiler warnings --- include/ada/url_pattern.h | 30 +++++++++++++++--------------- src/url_pattern.cpp | 3 ++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/include/ada/url_pattern.h b/include/ada/url_pattern.h index 525b760bf..677f87375 100644 --- a/include/ada/url_pattern.h +++ b/include/ada/url_pattern.h @@ -86,16 +86,16 @@ struct url_pattern_init { static tl::expected process_hash( std::string_view value, std::string_view type); - std::optional protocol; - std::optional username; - std::optional password; - std::optional hostname; - std::optional port; - std::optional pathname; - std::optional search; - std::optional hash; - - std::optional base_url; + std::optional protocol{}; + std::optional username{}; + std::optional password{}; + std::optional hostname{}; + std::optional port{}; + std::optional pathname{}; + std::optional search{}; + std::optional hash{}; + + std::optional base_url{}; }; enum class url_pattern_part_type : uint8_t { @@ -339,8 +339,8 @@ struct Token { // @see https://urlpattern.spec.whatwg.org/#tokenizer class Tokenizer { public: - explicit Tokenizer(std::string_view input, token_policy policy) - : input(input), policy(policy) {} + explicit Tokenizer(std::string_view new_input, token_policy new_policy) + : input(new_input), policy(new_policy) {} // @see https://urlpattern.spec.whatwg.org/#get-the-next-code-point void get_next_code_point(); @@ -377,9 +377,9 @@ class Tokenizer { // @see https://urlpattern.spec.whatwg.org/#constructor-string-parser struct constructor_string_parser { - explicit constructor_string_parser(std::string_view input, - std::vector& token_list) - : input(input), token_list(token_list){}; + explicit constructor_string_parser(std::string_view new_input, + std::vector& new_token_list) + : input(new_input), token_list(new_token_list){}; // @see https://urlpattern.spec.whatwg.org/#rewind void rewind(); diff --git a/src/url_pattern.cpp b/src/url_pattern.cpp index b2d5fd6c8..be18c6cf4 100644 --- a/src/url_pattern.cpp +++ b/src/url_pattern.cpp @@ -1,5 +1,6 @@ #include "ada.h" +#include #include #include #include @@ -1213,7 +1214,7 @@ std::string generate_pattern_string( std::string result{}; // Let index list be the result of getting the indices for part list. // For each index of index list: - for (size_t index : std::views::iota(size_t{0}, part_list.size())) { + for (size_t index : std::views::iota(0UL, part_list.size())) { // Let part be part list[index]. auto part = part_list[index]; // Let previous part be part list[index - 1] if index is greater than 0,