Skip to content

Commit

Permalink
url_parser::parse_path(...): use size_t to store ptr2-ptr1
Browse files Browse the repository at this point in the history
Previosly used int
  • Loading branch information
rmisev committed Apr 8, 2017
1 parent ff23785 commit 3ebfad0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,7 @@ inline void url_parser::parse_path(url_serializer& urls, const CharT* first, con
// path state; includes:
// 1. [ (/,\) - 1, 2, 3, 4 - [ 1 (if first segment), 2 ] ]
// 2. [ 1 ... 4 ]
auto double_dot = [](const CharT* const pointer, const int len) -> bool {
auto double_dot = [](const CharT* const pointer, const size_t len) -> bool {
if (len == 2) {
return (pointer[0] == '.' && pointer[1] == '.');
} else if (len == 4) {
Expand All @@ -1944,7 +1944,7 @@ inline void url_parser::parse_path(url_serializer& urls, const CharT* first, con
} else
return false;
};
auto single_dot = [](const CharT* const pointer, const int len) -> bool {
auto single_dot = [](const CharT* const pointer, const size_t len) -> bool {
if (len == 1) {
return pointer[0] == '.';
} else if (len == 3) {
Expand All @@ -1960,7 +1960,8 @@ inline void url_parser::parse_path(url_serializer& urls, const CharT* first, con
? std::find_if(pointer, last, is_slash<CharT>)
: std::find(pointer, last, '/');

int len = end_of_segment - pointer;
// end_of_segment >= pointer
const size_t len = end_of_segment - pointer;
bool is_last = end_of_segment == last;
// TODO-WARN: 1. If url is special and c is "\", validation error.

Expand Down

0 comments on commit 3ebfad0

Please sign in to comment.