mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 06:21:00 +00:00
Implement more printf length specifiers.
This commit is contained in:
parent
6a8becb5bf
commit
316ae7e244
16
format.cc
16
format.cc
@ -908,26 +908,30 @@ void fmt::internal::PrintfFormatter<Char>::format(
|
||||
}
|
||||
|
||||
// Parse length and convert the argument to the required type.
|
||||
switch (*s) {
|
||||
case 'h': {
|
||||
++s;
|
||||
switch (*s++) {
|
||||
case 'h':
|
||||
if (*s == 'h')
|
||||
ArgConverter<signed char>(arg, *++s).visit(arg);
|
||||
else
|
||||
ArgConverter<short>(arg, *s).visit(arg);
|
||||
break;
|
||||
}
|
||||
case 'l':
|
||||
++s;
|
||||
ArgConverter<long>(arg, *s).visit(arg);
|
||||
break;
|
||||
case 'j':
|
||||
ArgConverter<intmax_t>(arg, *s).visit(arg);
|
||||
break;
|
||||
case 'z':
|
||||
ArgConverter<size_t>(arg, *s).visit(arg);
|
||||
break;
|
||||
case 't':
|
||||
ArgConverter<ptrdiff_t>(arg, *s).visit(arg);
|
||||
break;
|
||||
case 'L':
|
||||
// TODO: handle length
|
||||
++s;
|
||||
break;
|
||||
default:
|
||||
--s;
|
||||
}
|
||||
|
||||
// Parse type.
|
||||
|
@ -350,8 +350,8 @@ TEST(PrintfTest, Length) {
|
||||
TestLength<unsigned char>("hh");
|
||||
TestLength<short>("h");
|
||||
TestLength<unsigned short>("h");
|
||||
//TestLength<long>("l");
|
||||
//TestLength<unsigned long>("l");
|
||||
TestLength<long>("l");
|
||||
TestLength<unsigned long>("l");
|
||||
// TODO: more tests
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user