Skip to content

Commit

Permalink
fix comparison of unsigned expression < 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime2 committed Sep 11, 2013
1 parent 7bc917a commit 995fa69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/positions_of_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ static std::string find_line(
const std::string& original_text, const GumboAttribute& attr) {
size_t attr_index = attr.original_value.data - original_text.data();
size_t begin = original_text.rfind("\n", attr_index) + 1;
size_t end = original_text.find("\n", attr_index) - 1;
ssize_t end = original_text.find("\n", attr_index) - 1;
if (end < 0) {
end = (size_t) original_text.length() - 1;
}
end = std::min(end, attr_index + 40);
end = std::min((size_t)end, attr_index + 40);
begin = std::max(begin, attr_index - 40);
return original_text.substr(begin, end - begin);
}
Expand Down

0 comments on commit 995fa69

Please sign in to comment.