]> 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:25:03 +0000 (03:25 +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 622e4f7ffd6350335060a4bd55c2a5d22fc8da36..4c8197821edf6b34a481f14d8d8f344dacbf2fdc 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 0e6220ae18c4d7021f3fe579248551eb2c593cd6..72b8cdbfa6b9742aa4a2886eddf1f2ca60906b52 100644 (file)
@@ -2130,7 +2130,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));
@@ -2175,7 +2175,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));
@@ -2232,7 +2232,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));
@@ -2277,7 +2277,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));
@@ -2334,7 +2334,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));
@@ -2379,7 +2379,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));