]> eyrie.org Git - kerberos/krb5-sync.git/commitdiff
Update portable/snprintf.c from rra-c-util
authorRuss Allbery <eagle@eyrie.org>
Thu, 5 Dec 2013 04:39:28 +0000 (20:39 -0800)
committerRuss Allbery <eagle@eyrie.org>
Thu, 5 Dec 2013 04:39:28 +0000 (20:39 -0800)
Contains some warning fixes for the new warning flags.

portable/snprintf.c

index 225455bed98c715785dcba41ab3da421c71b5162..c35ad807671286144845be9cb9c4570bdbe86801 100644 (file)
@@ -2,8 +2,9 @@
  * Replacement for a missing snprintf or vsnprintf.
  *
  * The following implementation of snprintf was taken mostly verbatim from
- * <http://www.fiction.net/~blong/programs/>; it is the version of snprintf
- * used in Mutt.
+ * <http://www.fiction.net/blong/programs/>; it is the version of snprintf
+ * used in Mutt.  A possibly newer version is used in wget, found at
+ * <https://github.com/wertarbyte/wget/blob/master/src/snprintf.c>.
  *
  * Please do not reformat or otherwise change this file more than necessary so
  * that later merges with the original source are easy.  Bug fixes and
@@ -432,7 +433,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
        break;
       case 'w':
        /* not supported yet, treat as next char */
-       ch = *format++;
+       format++;
        break;
       default:
        /* Unknown, skip */
@@ -695,7 +696,7 @@ static int fmtfp (char *buffer, size_t *currlen, size_t maxlen,
          /* For each leading 0 in fractional part, print one more
             fractional digit. */
          LDOUBLE temp;
-         if (ufvalue != 0)
+         if (ufvalue > 0)
            for (temp = ufvalue; temp < 0.1; temp *= 10)
              ++max;
        }