]> Savannah Git Hosting - gnulib.git/commitdiff
unistdio/*printf: Fix negative width handling for %U, %lU, %llU.
authorBruno Haible <bruno@clisp.org>
Sat, 28 Jan 2023 18:39:23 +0000 (19:39 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 10 Feb 2023 02:58:53 +0000 (03:58 +0100)
* lib/vasnprintf.c (VASNPRINTF): In the code for %U, %lU, %llU, test for
the FLAG_LEFT bit in the flags variable.

ChangeLog
lib/vasnprintf.c

index a766813bf0e3dba63d5fd13bf81ef5dcf22d2f07..10e1642f62cd9361ede8dd4d6e3d49ff3b615109 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-01-28  Bruno Haible  <bruno@clisp.org>
+
+       unistdio/*printf: Fix negative width handling for %U, %lU, %llU.
+       * lib/vasnprintf.c (VASNPRINTF): In the code for %U, %lU, %llU, test for
+       the FLAG_LEFT bit in the flags variable.
+
 2023-01-28  Bruno Haible  <bruno@clisp.org>
 
        vasnprintf-posix: Fix possible bug with negative width handling for %lc.
index 3febc16bed7be84fd8064e9188e07123784940b8..0617aab5bec9539dbd122ca1935196fab61de131 100644 (file)
@@ -2131,7 +2131,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           characters = 0;
                         }
 
-                      if (characters < width && !(dp->flags & FLAG_LEFT))
+                      if (characters < width && !(flags & FLAG_LEFT))
                         {
                           size_t n = width - characters;
                           ENSURE_ALLOCATION (xsum (length, n));
@@ -2176,7 +2176,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                       }
 # endif
 
-                      if (characters < width && (dp->flags & FLAG_LEFT))
+                      if (characters < width && (flags & FLAG_LEFT))
                         {
                           size_t n = width - characters;
                           ENSURE_ALLOCATION (xsum (length, n));
@@ -2233,7 +2233,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           characters = 0;
                         }
 
-                      if (characters < width && !(dp->flags & FLAG_LEFT))
+                      if (characters < width && !(flags & FLAG_LEFT))
                         {
                           size_t n = width - characters;
                           ENSURE_ALLOCATION (xsum (length, n));
@@ -2278,7 +2278,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                       }
 # endif
 
-                      if (characters < width && (dp->flags & FLAG_LEFT))
+                      if (characters < width && (flags & FLAG_LEFT))
                         {
                           size_t n = width - characters;
                           ENSURE_ALLOCATION (xsum (length, n));
@@ -2335,7 +2335,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           characters = 0;
                         }
 
-                      if (characters < width && !(dp->flags & FLAG_LEFT))
+                      if (characters < width && !(flags & FLAG_LEFT))
                         {
                           size_t n = width - characters;
                           ENSURE_ALLOCATION (xsum (length, n));
@@ -2380,7 +2380,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                       }
 # endif
 
-                      if (characters < width && (dp->flags & FLAG_LEFT))
+                      if (characters < width && (flags & FLAG_LEFT))
                         {
                           size_t n = width - characters;
                           ENSURE_ALLOCATION (xsum (length, n));