Skip to content

Commit

Permalink
fixing UB
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdasar1985 authored and horenmar committed May 29, 2020
1 parent b1b5cb8 commit 6c6ebe3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/external/clara.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ namespace detail {
}
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
std::string srcLC = source;
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( std::tolower(c) ); } );
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
target = true;
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
Expand Down
2 changes: 1 addition & 1 deletion include/internal/catch_string_manip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Catch {

namespace {
char toLowerCh(char c) {
return static_cast<char>( std::tolower( c ) );
return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/clara.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ namespace detail {
}
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
std::string srcLC = source;
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( ::tolower( c ) ); } );
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
target = true;
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
Expand Down

0 comments on commit 6c6ebe3

Please sign in to comment.