]> granicus.if.org Git - file/commitdiff
PR/384: remove %z formats that break windows.
authorChristos Zoulas <christos@zoulas.com>
Wed, 24 Sep 2014 19:49:07 +0000 (19:49 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 24 Sep 2014 19:49:07 +0000 (19:49 +0000)
src/apprentice.c
src/cdf.c
src/getline.c
src/softmagic.c

index 48e9cb0bbf378f5d860903c3ca720c0d4c8dde25..7d8bd1e1cfd37fbddc55a2cb8a6125d86ee4b911 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.215 2014/08/30 10:19:54 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.216 2014/09/24 19:49:07 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -464,7 +464,8 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
 
        if (action == FILE_LIST) {
                for (i = 0; i < MAGIC_SETS; i++) {
-                       printf("Set %zu:\nBinary patterns:\n", i);
+                       printf("Set %" SIZE_T_FORMAT "u:\nBinary patterns:\n",
+                           i);
                        apprentice_list(ms->mlist[i], BINTEST);
                        printf("Text patterns:\n");
                        apprentice_list(ms->mlist[i], TEXTTEST);
index 6cd4d819b1775abafb91fdb822ebb6112b0faf60..4c892c1d505f1b034e5e5c0cf423e353810cd4dc 100644 (file)
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.66 2014/08/27 06:59:35 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.67 2014/09/24 19:49:07 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -1156,7 +1156,7 @@ cdf_dump_header(const cdf_header_t *h)
        for (i = 0; i < __arraycount(h->h_master_sat); i++) {
                if (h->h_master_sat[i] == CDF_SECID_FREE)
                        break;
-               (void)fprintf(stderr, "%35.35s[%.3zu] = %d\n",
+               (void)fprintf(stderr, "%35.35s[%.3" SIZE_T_FORMAT "u] = %d\n",
                    "master_sat", i, h->h_master_sat[i]);
        }
 }
index 73ee513c6bddf6ee9db5d00f14941f0a56f766bd..ab5e1155cbb9454dd3ef77b9c2ea612fb3b9ac5f 100644 (file)
@@ -97,7 +97,7 @@ main(int argc, char *argv[])
        size_t n = 0;
 
        while ((len = getline(&p, &n, stdin)) != -1)
-               (void)printf("%zd %s", len, p);
+               (void)printf("%" SIZE_T_FORMAT "d %s", len, p);
        free(p);
        return 0;
 }
index bcbee4e5c0801b543a8935edae68aa528c1de156..bd7b9e8b05de21525b883f5cd75484ffb6192a62 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.194 2014/09/22 18:26:19 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.195 2014/09/24 19:49:07 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -95,8 +95,8 @@ file_fmtcheck(struct magic_set *ms, const struct magic *m, const char *def,
        const char *ptr = fmtcheck(m->desc, def);
        if (ptr == def)
                file_magerror(ms,
-                   "%s, %zu: format `%s' does not match with `%s'",
-                   file, line, m->desc, def);
+                   "%s, %" SIZE_T_FORMAT "u: format `%s' does not match"
+                   " with `%s'", file, line, m->desc, def);
        return ptr;
 }
 #else
@@ -1057,7 +1057,7 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
 private void
 mdebug(uint32_t offset, const char *str, size_t len)
 {
-       (void) fprintf(stderr, "mget/%zu @%d: ", len, offset);
+       (void) fprintf(stderr, "mget/%" SIZE_T_FORMAT "u @%d: ", len, offset);
        file_showstr(stderr, str, len);
        (void) fputc('\n', stderr);
        (void) fputc('\n', stderr);
@@ -1207,8 +1207,9 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
                return -1;
 
        if ((ms->flags & MAGIC_DEBUG) != 0) {
-               fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%zu, "
-                   "nbytes=%zu)\n", m->type, m->flag, offset, o, nbytes);
+               fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%"
+                   SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT "u)\n",
+                   m->type, m->flag, offset, o, nbytes);
                mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
 #ifndef COMPILE_ONLY
                file_mdump(m);
@@ -1963,7 +1964,8 @@ magiccheck(struct magic_set *ms, struct magic *m)
                            copy = malloc(slen);
                            if (copy == NULL)  {
                                file_error(ms, errno,
-                                   "can't allocate %zu bytes", slen);
+                                   "can't allocate %" SIZE_T_FORMAT "u bytes",
+                                   slen);
                                return -1;
                            }
                            memcpy(copy, ms->search.s, slen);