Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address coverity issues #843

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions include/ada/url_components-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ namespace ada {
* `--------------------------------------------- protocol_end
*/
// These conditions can be made more strict.
uint32_t index = 0;

if (protocol_end == url_components::omitted) {
return false;
}
if (protocol_end < index) {
return false;
}
index = protocol_end;
uint32_t index = protocol_end;

if (username_end == url_components::omitted) {
return false;
Expand Down
10 changes: 5 additions & 5 deletions src/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ bool url::set_host_or_hostname(const std::string_view input) {

bool succeeded = parse_host(host_view);
if (!succeeded) {
host = previous_host;
host = std::move(previous_host);
update_base_port(previous_port);
}
return succeeded;
Expand All @@ -733,13 +733,13 @@ bool url::set_host_or_hostname(const std::string_view input) {
} else {
// Let host be the result of host parsing buffer with url is not special.
if (!parse_host(new_host)) {
host = previous_host;
host = std::move(previous_host);
update_base_port(previous_port);
return false;
}

// If host is "localhost", then set host to the empty string.
if (host.has_value() && host.value() == "localhost") {
if (host == "localhost") {
host = "";
}
}
Expand Down Expand Up @@ -794,7 +794,7 @@ bool url::set_port(const std::string_view input) {
if (is_valid) {
return true;
}
port = previous_port;
port = std::move(previous_port);
is_valid = true;
return false;
}
Expand Down Expand Up @@ -835,7 +835,7 @@ bool url::set_pathname(const std::string_view input) {
if (has_opaque_path) {
return false;
}
path = "";
path.clear();
parse_path(input);
return true;
}
Expand Down
Loading