Skip to content

Commit d62c89a

Browse files
j6tgitster
authored andcommitted
compat/mingw.c: remove printf format warning
5096d49 (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 <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0fb1990 commit d62c89a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/mingw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,7 @@ void mingw_startup()
21312131

21322132
int uname(struct utsname *buf)
21332133
{
2134-
DWORD v = GetVersion();
2134+
unsigned v = (unsigned)GetVersion();
21352135
memset(buf, 0, sizeof(*buf));
21362136
xsnprintf(buf->sysname, sizeof(buf->sysname), "Windows");
21372137
xsnprintf(buf->release, sizeof(buf->release),

0 commit comments

Comments
 (0)