diff --git a/format.cc b/format.cc index b6dc3711..77a1ad7d 100644 --- a/format.cc +++ b/format.cc @@ -908,26 +908,30 @@ void fmt::internal::PrintfFormatter::format( } // Parse length and convert the argument to the required type. - switch (*s) { - case 'h': { - ++s; + switch (*s++) { + case 'h': if (*s == 'h') ArgConverter(arg, *++s).visit(arg); else ArgConverter(arg, *s).visit(arg); break; - } case 'l': - ++s; ArgConverter(arg, *s).visit(arg); break; case 'j': + ArgConverter(arg, *s).visit(arg); + break; case 'z': + ArgConverter(arg, *s).visit(arg); + break; case 't': + ArgConverter(arg, *s).visit(arg); + break; case 'L': // TODO: handle length - ++s; break; + default: + --s; } // Parse type. diff --git a/test/printf-test.cc b/test/printf-test.cc index 77fdf9b3..71d5637b 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -350,8 +350,8 @@ TEST(PrintfTest, Length) { TestLength("hh"); TestLength("h"); TestLength("h"); - //TestLength("l"); - //TestLength("l"); + TestLength("l"); + TestLength("l"); // TODO: more tests }