From 3450cf787f6b1ea3f083e147705c454d8efd4416 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Tue, 14 Jun 2016 18:52:41 -0400 Subject: [PATCH 4/7] Fix "format" compiler warnings * src/w32fns.c (w32_strerror): Use format specifier %d for sprintf argument of type int. (emacs_abort): Cast sprintf argument of type DWORD to unsigned int, and use format specifier %x, for compatibility with Cygwin. * src/w32font.c (w32_to_x_charset): Use format specifier %d for sprintf argument of type int. * src/w32term.c (x_draw_glyphless_glyph_string_foreground): Cast sprintf argument of type int to unsigned int to match %X format specifier. --- src/w32fns.c | 6 +++--- src/w32font.c | 4 ++-- src/w32term.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/w32fns.c b/src/w32fns.c index ff45f53..86ebc8f 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -8964,7 +8964,7 @@ w32_strerror (int error_no) --ret; buf[ret] = '\0'; if (!ret) - sprintf (buf, "w32 error %u", error_no); + sprintf (buf, "w32 error %d", error_no); return buf; } @@ -10333,8 +10333,8 @@ emacs_abort (void) but not on Windows 7. addr2line doesn't mind a missing "0x", but will be confused by an extra one. */ if (except_addr) - sprintf (buf, "\r\nException 0x%lx at this address:\r\n%p\r\n", - except_code, except_addr); + sprintf (buf, "\r\nException 0x%x at this address:\r\n%p\r\n", + (unsigned int) except_code, except_addr); if (stderr_fd >= 0) { if (except_addr) diff --git a/src/w32font.c b/src/w32font.c index b8884a5..4d15cff 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -1747,7 +1747,7 @@ w32_to_x_charset (int fncharset, char *matching) default: /* Encode numerical value of unknown charset. */ - sprintf (buf, "*-#%u", fncharset); + sprintf (buf, "*-#%d", fncharset); return buf; } @@ -1834,7 +1834,7 @@ w32_to_x_charset (int fncharset, char *matching) /* If no match, encode the numeric value. */ if (!best_match) { - sprintf (buf, "*-#%u", fncharset); + sprintf (buf, "*-#%d", fncharset); return buf; } diff --git a/src/w32term.c b/src/w32term.c index 649e743..4462517 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1434,7 +1434,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) { sprintf ((char *) buf, "%0*X", glyph->u.glyphless.ch < 0x10000 ? 4 : 6, - glyph->u.glyphless.ch); + (unsigned int) glyph->u.glyphless.ch); str = buf; } -- 2.8.3