1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-05 21:42:47 -05:00

New wrapper macro for printf("%zu"), for old VS compat.

A user reports that Visual Studio 2013 and earlier have printf
implementations in their C library that don't support the 'z' modifier
to indicate that an integer argument is size_t. The 'I' modifier
apparently works in place of it.

To avoid littering ifdefs everywhere, I've invented my own inttypes.h
style macros to wrap size_t formatting directives, which are defined
to %zu and %zx normally, or %Iu and %Ix in old-VS mode. Those are in
defs.h, and they're used everywhere that a %z might otherwise get into
the Windows build.
This commit is contained in:
Simon Tatham
2020-01-26 10:59:07 +00:00
parent 247866a9d3
commit 82a7e8c4ac
9 changed files with 29 additions and 20 deletions

View File

@ -1286,7 +1286,7 @@ int main(int argc, char **argv)
for (size_t i = 0; i < sb->len; i++)
if (sb->s[i] == '\n')
lines++;
fprintf(outfp, "%zu\n%s", lines, sb->s);
fprintf(outfp, "%"SIZEu"\n%s", lines, sb->s);
fflush(outfp);
strbuf_free(sb);
sfree(line);