Added some coercions to remove gcc complaints in snprintf_2.2.

Sat, 14 May 2005 22:23:20 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 14 May 2005 22:23:20 +0200
changeset 100
8ae0f0aa5a16
parent 99
46ee75d9eba9
child 101
50525dab6c8e

Added some coercions to remove gcc complaints in snprintf_2.2.

snprintf_2.2/snprintf.c file | annotate | diff | comparison | revisions
--- a/snprintf_2.2/snprintf.c	Fri Mar 25 17:48:19 2005 +0100
+++ b/snprintf_2.2/snprintf.c	Sat May 14 22:23:20 2005 +0200
@@ -565,7 +565,7 @@
    /* but the following code achieves better performance for cases
     * where format string is long and contains few conversions */
       const char *q = strchr(p+1,'%');
-      size_t n = !q ? strlen(p) : (q-p);
+      size_t n = !q ? strlen(p) : (size_t)(q-p);
       if (str_l < str_m) {
         size_t avail = str_m-str_l;
         fast_memcpy(str+str_l, p, (n>avail?avail:n));
@@ -714,7 +714,7 @@
        /* memchr on HP does not like n > 2^31  !!! */
             const char *q = memchr(str_arg, '\0',
                              precision <= 0x7fffffff ? precision : 0x7fffffff);
-            str_arg_l = !q ? precision : (q-str_arg);
+            str_arg_l = !q ? precision : (size_t)(q-str_arg);
           }
           break;
         default: break;

mercurial