Fix warnings

This commit is contained in:
Victor Zverovich 2021-06-29 22:25:14 -07:00
parent fbb70eec5c
commit 785908ee37
2 changed files with 7 additions and 5 deletions

View File

@ -2427,7 +2427,7 @@ FMT_CONSTEXPR FMT_INLINE void parse_format_string(
if (pbegin == pend) return; if (pbegin == pend) return;
for (;;) { for (;;) {
const Char* p = nullptr; const Char* p = nullptr;
if (!find<IS_CONSTEXPR>(pbegin, pend, '}', p)) if (!find<IS_CONSTEXPR>(pbegin, pend, Char('}'), p))
return handler_.on_text(pbegin, pend); return handler_.on_text(pbegin, pend);
++p; ++p;
if (p == pend || *p != '}') if (p == pend || *p != '}')
@ -2442,7 +2442,7 @@ FMT_CONSTEXPR FMT_INLINE void parse_format_string(
// Doing two passes with memchr (one for '{' and another for '}') is up to // Doing two passes with memchr (one for '{' and another for '}') is up to
// 2.5x faster than the naive one-pass implementation on big format strings. // 2.5x faster than the naive one-pass implementation on big format strings.
const Char* p = begin; const Char* p = begin;
if (*begin != '{' && !find<IS_CONSTEXPR>(begin + 1, end, '{', p)) if (*begin != '{' && !find<IS_CONSTEXPR>(begin + 1, end, Char('{'), p))
return write(begin, end); return write(begin, end);
write(begin, p); write(begin, p);
begin = parse_replacement_field(p, end, handler); begin = parse_replacement_field(p, end, handler);

View File

@ -882,8 +882,10 @@ template <typename T = void> struct basic_data {
FMT_API static constexpr const char signs[4] = {0, '-', '+', ' '}; FMT_API static constexpr const char signs[4] = {0, '-', '+', ' '};
FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', FMT_API static constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+',
0x1000000u | ' '}; 0x1000000u | ' '};
FMT_API static constexpr const char left_padding_shifts[5] = {31, 31, 0, 1, 0}; FMT_API static constexpr const char left_padding_shifts[5] = {31, 31, 0, 1,
FMT_API static constexpr const char right_padding_shifts[5] = {0, 31, 0, 1, 0}; 0};
FMT_API static constexpr const char right_padding_shifts[5] = {0, 31, 0, 1,
0};
}; };
#ifdef FMT_SHARED #ifdef FMT_SHARED
@ -1023,7 +1025,7 @@ template <> inline auto decimal_point(locale_ref loc) -> wchar_t {
// Compares two characters for equality. // Compares two characters for equality.
template <typename Char> auto equal2(const Char* lhs, const char* rhs) -> bool { template <typename Char> auto equal2(const Char* lhs, const char* rhs) -> bool {
return lhs[0] == rhs[0] && lhs[1] == rhs[1]; return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]);
} }
inline auto equal2(const char* lhs, const char* rhs) -> bool { inline auto equal2(const char* lhs, const char* rhs) -> bool {
return memcmp(lhs, rhs, 2) == 0; return memcmp(lhs, rhs, 2) == 0;