From: Bruno Haible Date: Sat, 21 Jun 2025 21:49:24 +0000 (+0200) Subject: c-format: Accept null precision. X-Git-Tag: v0.26~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=688d443b26b2fd9155751d56bfffdd847e868dbf;p=thirdparty%2Fgettext.git c-format: Accept null precision. * gettext-tools/src/format-c-parse.h: Fix comment regarding the precision and the ISO C23 size specifiers. * gettext-tools/tests/format-c-1: Add a test case with null precision. --- diff --git a/gettext-tools/src/format-c-parse.h b/gettext-tools/src/format-c-parse.h index c0ea33395..da9d22549 100644 --- a/gettext-tools/src/format-c-parse.h +++ b/gettext-tools/src/format-c-parse.h @@ -28,10 +28,10 @@ - is optionally followed by a width specification: '*' (reads an argument) or '*m$' or a nonempty digit sequence, - is optionally followed by '.' and a precision specification: '*' (reads - an argument) or '*m$' or a nonempty digit sequence, + an argument) or '*m$' or an optional nonempty digit sequence, - is either continued like this: - is optionally followed by a size specifier, one of 'hh' 'h' 'l' 'll' - 'L' 'q' 'j' 'z' 't', + 'L' 'q' 'j' 'z' 't' 'w8' 'w16' 'w32' 'w64' 'wf8' 'wf16' 'wf32' 'wf64', - is finished by a specifier - '%', that needs no argument, - 'c', 'C', that need a character argument, diff --git a/gettext-tools/tests/format-c-1 b/gettext-tools/tests/format-c-1 index 64645ba40..4abc8be76 100755 --- a/gettext-tools/tests/format-c-1 +++ b/gettext-tools/tests/format-c-1 @@ -178,6 +178,8 @@ cat <<\EOF > f-c-1.data "abc%y" # Invalid: flags after width "abc%*0g" +# Valid: null precision +"abc%.f" # Invalid: twice precision "abc%.4.2g" # Valid: three arguments