From c56c14a12fb88af5e651773027edf0fd413a7403 Mon Sep 17 00:00:00 2001 From: Adrian Robert Date: Tue, 13 Oct 2009 01:03:38 +0000 Subject: [PATCH] (font_unparse_xlfd, font_unparse_fcname): Use long format in printf, and cast argument. --- src/font.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/font.c b/src/font.c index 1cd596b9139..2e5db2d8f10 100644 --- a/src/font.c +++ b/src/font.c @@ -1352,8 +1352,8 @@ font_unparse_xlfd (font, pixel_size, name, nbytes) if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) { f[XLFD_AVGWIDTH_INDEX] = alloca (11); - len += sprintf (f[XLFD_AVGWIDTH_INDEX], - "%d", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; + len += sprintf (f[XLFD_AVGWIDTH_INDEX], "%ld", + (long) XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; } else f[XLFD_AVGWIDTH_INDEX] = "*", len += 2; @@ -1669,7 +1669,7 @@ font_unparse_fcname (font, pixel_size, name, nbytes) } if (INTEGERP (AREF (font, FONT_DPI_INDEX))) - len += sprintf (work, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX))); + len += sprintf (work, ":dpi=%ld", (long)XINT (AREF (font, FONT_DPI_INDEX))); if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) len += strlen (":spacing=100"); if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) @@ -1682,7 +1682,7 @@ font_unparse_fcname (font, pixel_size, name, nbytes) if (STRINGP (val)) len += SBYTES (val); else if (INTEGERP (val)) - len += sprintf (work, "%d", XINT (val)); + len += sprintf (work, "%ld", (long) XINT (val)); else if (SYMBOLP (val)) len += (NILP (val) ? 5 : 4); /* for "false" or "true" */ } @@ -1709,9 +1709,10 @@ font_unparse_fcname (font, pixel_size, name, nbytes) p += sprintf (p, ":%s=%s", style_names[i], SDATA (SYMBOL_NAME (styles[i]))); if (INTEGERP (AREF (font, FONT_DPI_INDEX))) - p += sprintf (p, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX))); + p += sprintf (p, ":dpi=%ld", (long) XINT (AREF (font, FONT_DPI_INDEX))); if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) - p += sprintf (p, ":spacing=%d", XINT (AREF (font, FONT_SPACING_INDEX))); + p += sprintf (p, ":spacing=%ld", + (long) XINT (AREF (font, FONT_SPACING_INDEX))); if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) { if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0)