mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-23 22:06:10 +01:00
fixing UB
This commit is contained in:
parent
5c502320e8
commit
3ceaad7d66
@ -667,7 +667,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
||||||
std::string srcLC = source;
|
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")
|
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
||||||
target = true;
|
target = true;
|
||||||
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
||||||
|
@ -18,7 +18,7 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
char toLowerCh(char c) {
|
char toLowerCh(char c) {
|
||||||
return static_cast<char>( std::tolower( c ) );
|
return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
third_party/clara.hpp
vendored
2
third_party/clara.hpp
vendored
@ -667,7 +667,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
||||||
std::string srcLC = source;
|
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")
|
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
||||||
target = true;
|
target = true;
|
||||||
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
||||||
|
Loading…
Reference in New Issue
Block a user