From: Christos Zoulas Date: Wed, 24 Sep 2014 19:49:07 +0000 (+0000) Subject: PR/384: remove %z formats that break windows. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9dd90008abd6b7ff459dae514b9d294449a534de;p=file PR/384: remove %z formats that break windows. --- diff --git a/src/apprentice.c b/src/apprentice.c index 48e9cb0b..7d8bd1e1 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -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); diff --git a/src/cdf.c b/src/cdf.c index 6cd4d819..4c892c1d 100644 --- 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 @@ -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]); } } diff --git a/src/getline.c b/src/getline.c index 73ee513c..ab5e1155 100644 --- a/src/getline.c +++ b/src/getline.c @@ -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; } diff --git a/src/softmagic.c b/src/softmagic.c index bcbee4e5..bd7b9e8b 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -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);