compat/mingw.c: remove printf format warning
authorJohannes Sixt <j6t@kdbg.org>
Fri, 23 Oct 2015 06:02:52 +0000 (08:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Oct 2015 17:17:53 +0000 (10:17 -0700)
5096d490 (convert trivial sprintf / strcpy calls to xsnprintf) converted
two sprintf calls. Now GCC warns that "format '%u' expects argument of
type 'unsigned int', but argument 4 has type 'long unsigned int'".
Instead of changing the format string, use a variable of type unsigned
in place of the typedef-ed type DWORD, which hides that it is actually an
unsigned long.

There is no correctness issue with the old code because unsigned long and
unsigned are always of the same size on Windows, even in 64-bit builds.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c
index a168800ae0d1a6ffe741dfda26dbe5133cc4c4fc..90bdb1edde15ccd39055c376f5d920c29af013c0 100644 (file)
@@ -2131,7 +2131,7 @@ void mingw_startup()
 
 int uname(struct utsname *buf)
 {
-       DWORD v = GetVersion();
+       unsigned v = (unsigned)GetVersion();
        memset(buf, 0, sizeof(*buf));
        xsnprintf(buf->sysname, sizeof(buf->sysname), "Windows");
        xsnprintf(buf->release, sizeof(buf->release),