Skip to content

Commit

Permalink
refactor: no implicit char conversions
Browse files Browse the repository at this point in the history
fix #816
  • Loading branch information
alandefreitas committed Feb 7, 2024
1 parent 47c8323 commit 621b50e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/boost/url/detail/encode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ re_encode_unsafe(
detail::hexdigs[opt.lower_case];
auto const encode = [end, hex](
char*& dest,
unsigned char c) noexcept
char c0) noexcept
{
auto c = static_cast<unsigned char>(c0);
ignore_unused(end);
*dest++ = '%';
BOOST_ASSERT(dest != end);
Expand Down
8 changes: 8 additions & 0 deletions include/boost/url/grammar/lut_chars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ class lut_chars
bool
operator()(
unsigned char ch) const noexcept
{
return operator()(static_cast<char>(ch));
}

/// @copydoc operator()(unsigned char) const
constexpr
bool
operator()(char ch) const noexcept
{
return mask_[lo(ch)] & hi(ch);
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_rule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test_char_set(
for_each_char(
[&cs](char c)
{
if(cs(0) || ! cs(c))
if(cs(static_cast<unsigned char>(0)) || ! cs(c))
{
if(cs(c))
{
Expand Down

0 comments on commit 621b50e

Please sign in to comment.