mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-26 12:35:32 +00:00
Fix sign handling with large code units
This commit is contained in:
parent
779449fd99
commit
1f95c34381
@ -1998,7 +1998,10 @@ auto write_int_localized(OutputIt out, UInt value, unsigned prefix,
|
||||
grouping.count_separators(num_digits));
|
||||
return write_padded<align::right>(
|
||||
out, specs, size, size, [&](reserve_iterator<OutputIt> it) {
|
||||
if (prefix != 0) *it++ = static_cast<Char>(prefix);
|
||||
if (prefix != 0) {
|
||||
char sign = static_cast<char>(prefix);
|
||||
*it++ = static_cast<Char>(sign);
|
||||
}
|
||||
return grouping.apply(it, string_view(digits, to_unsigned(num_digits)));
|
||||
});
|
||||
}
|
||||
@ -2157,7 +2160,8 @@ class counting_iterator {
|
||||
return it;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR friend counting_iterator operator+(counting_iterator it, difference_type n) {
|
||||
FMT_CONSTEXPR friend counting_iterator operator+(counting_iterator it,
|
||||
difference_type n) {
|
||||
it.count_ += static_cast<size_t>(n);
|
||||
return it;
|
||||
}
|
||||
|
@ -513,4 +513,8 @@ TEST(locale_test, chrono_weekday) {
|
||||
std::locale::global(loc_old);
|
||||
}
|
||||
|
||||
TEST(locale_test, sign) {
|
||||
EXPECT_EQ(fmt::format(std::locale(), L"{:L}", -50), L"-50");
|
||||
}
|
||||
|
||||
#endif // FMT_STATIC_THOUSANDS_SEPARATOR
|
||||
|
Loading…
x
Reference in New Issue
Block a user