From: Oliver Kurth Date: Wed, 30 Oct 2019 18:18:20 +0000 (-0700) Subject: Fix misc. warnings in base64.c X-Git-Tag: stable-11.1.0~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee8c9ece23ec51b8388991884fc68ae890cc3312;p=thirdparty%2Fopen-vm-tools.git Fix misc. warnings in base64.c At few places in the code, %ld is being used as the format specifier for printing the variables of size_t datatype. Changed it to %FMTSZu. --- diff --git a/open-vm-tools/lib/misc/base64.c b/open-vm-tools/lib/misc/base64.c index b66cee96a..ca5ffbfc3 100644 --- a/open-vm-tools/lib/misc/base64.c +++ b/open-vm-tools/lib/misc/base64.c @@ -271,7 +271,7 @@ main() bufMax = sizeof buf; } - printf("\nBuffer size %ld:\n", bufMax); + printf("\nBuffer size %"FMTSZ"u:\n", bufMax); test = tests; for (; test->in; ++test) { @@ -280,14 +280,14 @@ main() r = Base64_Decode(test->in, buf, bufMax, &bufSize); if ((bufMax > strlen(test->out)) && (bufSize < strlen(test->out))) { - printf("Decoding of %s failed. Decoded size %ld < expected %ld\n", + printf("Decoding of %s failed. Decoded size %"FMTSZ"u < expected %"FMTSZ"u\n", test->in, bufSize, strlen(test->out)); } if (memcmp(test->out, buf, bufSize) != 0) { - printf("Decoding of %s failed. Got %s (%ld), not %s\n", + printf("Decoding of %s failed. Got %s (%"FMTSZ"u), not %s\n", test->in, buf, bufSize, test->out); } else { - printf("Good: %s -> %s (%ld)\n", test->in, buf, bufSize); + printf("Good: %s -> %s (%"FMTSZ"u)\n", test->in, buf, bufSize); } r = Base64_Encode(test->out, strlen(test->out), @@ -295,14 +295,14 @@ main() buf[bufMax] = 0; if (bufMax <= strlen(test->in) && r == 0) { - printf("Good: %s. Failed for bufMax %ld (required %ld)\n", test->out, bufMax, strlen(test->in)); + printf("Good: %s. Failed for bufMax %"FMTSZ"u (required %"FMTSZ"u)\n", test->out, bufMax, strlen(test->in)); } else { if (!r || bufSize != strlen(test->in) || strncmp(test->in, buf, bufSize) != 0) { - printf("Encoding of %s failed. r = %d. Got %s (%ld), not %s\n", + printf("Encoding of %s failed. r = %d. Got %s (%"FMTSZ"u), not %s\n", test->out, r, buf, bufSize, test->in); } else { - printf("Good: %s -> %s (%ld)\n", test->out, buf, bufSize); + printf("Good: %s -> %s (%"FMTSZ"u)\n", test->out, buf, bufSize); } } }