Skip to content

Commit

Permalink
Added a couple of statis_casts to eliminate signed conversion warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
nemtrif committed Oct 17, 2022
1 parent ee90a4a commit aa3b12c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/utf8/checked.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace utf8
case internal::INVALID_LEAD :
case internal::INCOMPLETE_SEQUENCE :
case internal::OVERLONG_SEQUENCE :
throw invalid_utf8(*it);
throw invalid_utf8(static_cast<uint8_t>(*it));
case internal::INVALID_CODE_POINT :
throw invalid_code_point(cp);
}
Expand Down
2 changes: 1 addition & 1 deletion source/utf8/cpp11.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace utf8
inline std::size_t find_invalid(const std::string& s)
{
std::string::const_iterator invalid = find_invalid(s.begin(), s.end());
return (invalid == s.end()) ? std::string::npos : (invalid - s.begin());
return (invalid == s.end()) ? std::string::npos : static_cast<std::size_t>(invalid - s.begin());
}

inline bool is_valid(const std::string& s)
Expand Down
2 changes: 1 addition & 1 deletion source/utf8/cpp17.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace utf8
inline std::size_t find_invalid(std::string_view s)
{
std::string_view::const_iterator invalid = find_invalid(s.begin(), s.end());
return (invalid == s.end()) ? std::string_view::npos : (invalid - s.begin());
return (invalid == s.end()) ? std::string_view::npos : static_cast<std::size_t>(invalid - s.begin());
}

inline bool is_valid(std::string_view s)
Expand Down

0 comments on commit aa3b12c

Please sign in to comment.