]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
vasnprintf: avoid compiler warnings
authorEric Blake <ebb9@byu.net>
Sat, 12 Dec 2009 14:54:48 +0000 (15:54 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 12 Dec 2009 14:59:27 +0000 (15:59 +0100)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/vasnprintf.c
gettext-runtime/libasprintf/ChangeLog
gettext-runtime/libasprintf/vasnprintf.c

index 3efacdbbeb196ba5d980b375048ef422eb66647a..01c65c3923b7eec65f9a9f99e40d705884a76c0c 100644 (file)
@@ -1,3 +1,7 @@
+2009-11-17  Eric Blake  <ebb9@byu.net>
+
+       * vasnprintf.c (VASNPRINTF): Avoid shadowing our own local variables.
+
 2009-10-10  Eric Blake  <ebb9@byu.net>
 
        * relocatable.c (compute_curr_prefix): Fix spelling.
index e198646bffec6d656cef55226e6ea3efebb9def9..791376b2164e3e4ae07de8a49707e79ace5a9a7c 100644 (file)
@@ -2376,16 +2376,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      while (precision > 0)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2421,16 +2421,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      for (;;)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2471,20 +2471,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                    for (remaining = characters; remaining > 0; )
                      {
-                       char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                       char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                        int count;
 
                        if (*arg == 0)
                          abort ();
 #   if HAVE_WCRTOMB
-                       count = wcrtomb (buf, *arg, &state);
+                       count = wcrtomb (cbuf, *arg, &state);
 #   else
-                       count = wctomb (buf, *arg);
+                       count = wctomb (cbuf, *arg);
 #   endif
                        if (count <= 0)
                          /* Inconsistency.  */
                          abort ();
-                       memcpy (tmpptr, buf, count);
+                       memcpy (tmpptr, cbuf, count);
                        tmpptr += count;
                        arg++;
                        remaining -= count;
@@ -2553,20 +2553,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      ENSURE_ALLOCATION (xsum (length, characters));
                      for (remaining = characters; remaining > 0; )
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                          remaining -= count;
@@ -2582,21 +2582,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                      while (arg < arg_end)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
                          ENSURE_ALLOCATION (xsum (length, count));
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                        }
index 18d875eaa23c50a50d4923df8e5a218cae1f7475..458c2c5cf2f90b1f0d43d6d3d9af27736d28cccf 100644 (file)
@@ -1,3 +1,7 @@
+2009-11-17  Eric Blake  <ebb9@byu.net>
+
+       * vasnprintf.c (VASNPRINTF): Avoid shadowing our own local variables.
+
 2009-08-20  Eric Blake  <ebb9@byu.net>
 
        * vasnprintf.c (decimal_point_char): Avoid warning on old-style
index e198646bffec6d656cef55226e6ea3efebb9def9..791376b2164e3e4ae07de8a49707e79ace5a9a7c 100644 (file)
@@ -2376,16 +2376,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      while (precision > 0)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2421,16 +2421,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      characters = 0;
                      for (;;)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg_end == 0)
                            /* Found the terminating null wide character.  */
                            break;
 #  if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg_end, &state);
+                         count = wcrtomb (cbuf, *arg_end, &state);
 #  else
-                         count = wctomb (buf, *arg_end);
+                         count = wctomb (cbuf, *arg_end);
 #  endif
                          if (count < 0)
                            {
@@ -2471,20 +2471,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                    for (remaining = characters; remaining > 0; )
                      {
-                       char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                       char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                        int count;
 
                        if (*arg == 0)
                          abort ();
 #   if HAVE_WCRTOMB
-                       count = wcrtomb (buf, *arg, &state);
+                       count = wcrtomb (cbuf, *arg, &state);
 #   else
-                       count = wctomb (buf, *arg);
+                       count = wctomb (cbuf, *arg);
 #   endif
                        if (count <= 0)
                          /* Inconsistency.  */
                          abort ();
-                       memcpy (tmpptr, buf, count);
+                       memcpy (tmpptr, cbuf, count);
                        tmpptr += count;
                        arg++;
                        remaining -= count;
@@ -2553,20 +2553,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      ENSURE_ALLOCATION (xsum (length, characters));
                      for (remaining = characters; remaining > 0; )
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                          remaining -= count;
@@ -2582,21 +2582,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #   endif
                      while (arg < arg_end)
                        {
-                         char buf[64]; /* Assume MB_CUR_MAX <= 64.  */
+                         char cbuf[64]; /* Assume MB_CUR_MAX <= 64.  */
                          int count;
 
                          if (*arg == 0)
                            abort ();
 #   if HAVE_WCRTOMB
-                         count = wcrtomb (buf, *arg, &state);
+                         count = wcrtomb (cbuf, *arg, &state);
 #   else
-                         count = wctomb (buf, *arg);
+                         count = wctomb (cbuf, *arg);
 #   endif
                          if (count <= 0)
                            /* Inconsistency.  */
                            abort ();
                          ENSURE_ALLOCATION (xsum (length, count));
-                         memcpy (result + length, buf, count);
+                         memcpy (result + length, cbuf, count);
                          length += count;
                          arg++;
                        }