Skip to content

Commit

Permalink
fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Dec 12, 2024
1 parent 7a4a504 commit 010bc69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
30 changes: 15 additions & 15 deletions include/ada/url_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ struct url_pattern_init {
static tl::expected<std::string, url_pattern_errors> process_hash(
std::string_view value, std::string_view type);

std::optional<std::string> protocol;
std::optional<std::string> username;
std::optional<std::string> password;
std::optional<std::string> hostname;
std::optional<std::string> port;
std::optional<std::string> pathname;
std::optional<std::string> search;
std::optional<std::string> hash;

std::optional<std::string> base_url;
std::optional<std::string> protocol{};
std::optional<std::string> username{};
std::optional<std::string> password{};
std::optional<std::string> hostname{};
std::optional<std::string> port{};
std::optional<std::string> pathname{};
std::optional<std::string> search{};
std::optional<std::string> hash{};

std::optional<std::string> base_url{};
};

enum class url_pattern_part_type : uint8_t {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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>& token_list)
: input(input), token_list(token_list){};
explicit constructor_string_parser(std::string_view new_input,
std::vector<Token>& new_token_list)
: input(new_input), token_list(new_token_list){};

// @see https://urlpattern.spec.whatwg.org/#rewind
void rewind();
Expand Down
3 changes: 2 additions & 1 deletion src/url_pattern.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ada.h"

#include <algorithm>
#include <optional>
#include <ranges>
#include <regex>
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 010bc69

Please sign in to comment.