Fix some formatting output issues
This commit is contained in:
parent
d4ab8fb401
commit
5eb7821cfc
@ -299,6 +299,7 @@ namespace rexy::fmt::detail{
|
|||||||
case presentation::string_t:
|
case presentation::string_t:
|
||||||
break;
|
break;
|
||||||
case presentation::int_t:
|
case presentation::int_t:
|
||||||
|
case presentation::char_t:
|
||||||
return perform_standard_format<Char>(static_cast<unsigned char>(b), std::move(out), specs, loc);
|
return perform_standard_format<Char>(static_cast<unsigned char>(b), std::move(out), specs, loc);
|
||||||
default:
|
default:
|
||||||
REXY_THROW_FORMAT_ERROR("Invalid type argument for bool");
|
REXY_THROW_FORMAT_ERROR("Invalid type argument for bool");
|
||||||
@ -378,7 +379,7 @@ namespace rexy::fmt::detail{
|
|||||||
base = 2;
|
base = 2;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
prefix = "0";
|
prefix = b == 0 ? "" : "0";
|
||||||
base = 8;
|
base = 8;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
@ -571,7 +572,7 @@ namespace rexy::fmt::detail{
|
|||||||
const auto outputter = [&](OutIt o){
|
const auto outputter = [&](OutIt o){
|
||||||
Char radix_char = '.';
|
Char radix_char = '.';
|
||||||
o = perform_format_write_sign(std::move(o), specs.sign, f);
|
o = perform_format_write_sign(std::move(o), specs.sign, f);
|
||||||
if(should_zero_fill && specs.width > total_width){
|
if(should_zero_fill && specs.width > total_width && !(is_infinity || is_nan)){
|
||||||
const int fill_width = specs.width - total_width;
|
const int fill_width = specs.width - total_width;
|
||||||
for(int i = 0;i < fill_width;++i){
|
for(int i = 0;i < fill_width;++i){
|
||||||
*o++ = '0';
|
*o++ = '0';
|
||||||
|
|||||||
@ -312,7 +312,7 @@ namespace rexy::fmt::detail{
|
|||||||
if(chosen == presentation::default_t){
|
if(chosen == presentation::default_t){
|
||||||
chosen = presentation::string_t;
|
chosen = presentation::string_t;
|
||||||
}
|
}
|
||||||
if(chosen != presentation::string_t && chosen != presentation::int_t){
|
if(chosen != presentation::string_t && chosen != presentation::int_t && chosen != presentation::char_t){
|
||||||
REXY_THROW_FORMAT_ERROR("Invalid type specifier for bool");
|
REXY_THROW_FORMAT_ERROR("Invalid type specifier for bool");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -36,6 +36,7 @@ REXY_REQUIRES_CPP20;
|
|||||||
#include "detail/format/arg_store.hpp"
|
#include "detail/format/arg_store.hpp"
|
||||||
#include "detail/format/format_string.hpp"
|
#include "detail/format/format_string.hpp"
|
||||||
#include "detail/format/format_args.hpp"
|
#include "detail/format/format_args.hpp"
|
||||||
|
#include "detail/format/format_error.hpp"
|
||||||
|
|
||||||
#include <cstdio> //FILE
|
#include <cstdio> //FILE
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user