Fix template args to avoid conversion warnings

Fix avoids a warning about sign conversion when included from a file compiled with -Werror=sign-conversion.
This commit is contained in:
SketchyLizard 2021-11-17 09:01:12 -05:00 committed by Martin Hořeňovský
parent fabe614ba8
commit 2db1cf3404

View File

@ -205,7 +205,7 @@ namespace Catch {
}; };
#endif // CATCH_CONFIG_WCHAR #endif // CATCH_CONFIG_WCHAR
template<int SZ> template<size_t SZ>
struct StringMaker<char[SZ]> { struct StringMaker<char[SZ]> {
static std::string convert(char const* str) { static std::string convert(char const* str) {
// Note that `strnlen` is not actually part of standard C++, // Note that `strnlen` is not actually part of standard C++,
@ -214,7 +214,7 @@ namespace Catch {
StringRef( str, strnlen( str, SZ ) ) ); StringRef( str, strnlen( str, SZ ) ) );
} }
}; };
template<int SZ> template<size_t SZ>
struct StringMaker<signed char[SZ]> { struct StringMaker<signed char[SZ]> {
static std::string convert(signed char const* str) { static std::string convert(signed char const* str) {
// See the plain `char const*` overload // See the plain `char const*` overload
@ -223,7 +223,7 @@ namespace Catch {
StringRef(reinterpreted, strnlen(reinterpreted, SZ))); StringRef(reinterpreted, strnlen(reinterpreted, SZ)));
} }
}; };
template<int SZ> template<size_t SZ>
struct StringMaker<unsigned char[SZ]> { struct StringMaker<unsigned char[SZ]> {
static std::string convert(unsigned char const* str) { static std::string convert(unsigned char const* str) {
// See the plain `char const*` overload // See the plain `char const*` overload
@ -522,7 +522,7 @@ namespace Catch {
} }
}; };
template <typename T, int SZ> template <typename T, size_t SZ>
struct StringMaker<T[SZ]> { struct StringMaker<T[SZ]> {
static std::string convert(T const(&arr)[SZ]) { static std::string convert(T const(&arr)[SZ]) {
return rangeToString(arr); return rangeToString(arr);