From e240ae00f172f63596dd3ad0b9b66bb5ae739ce1 Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Wed, 29 Nov 2006 15:02:15 +0100
Subject: [PATCH] use __attribute__ format(printf)

---
 flower/include/file-cookie.hh    | 3 ++-
 flower/include/libc-extension.hh | 1 +
 flower/include/string-convert.hh | 2 +-
 lily/ttf.cc                      | 6 +++---
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/flower/include/file-cookie.hh b/flower/include/file-cookie.hh
index ab163ea3eb..ab2558fd14 100644
--- a/flower/include/file-cookie.hh
+++ b/flower/include/file-cookie.hh
@@ -24,7 +24,8 @@ using namespace std;
 			  lily_cookie_io_functions_t io_funcs);
 
   int lily_cookie_fclose (void *);
-  int lily_cookie_fprintf (void *file, char const *format, ...);
+  int lily_cookie_fprintf (void *file, char const *format, ...)
+    __attribute__ ((format (printf, 2, 3)));
   int lily_cookie_putc (int c, void *file);
 
 #ifdef __cplusplus
diff --git a/flower/include/libc-extension.hh b/flower/include/libc-extension.hh
index da4291604c..236b731d8a 100644
--- a/flower/include/libc-extension.hh
+++ b/flower/include/libc-extension.hh
@@ -37,6 +37,7 @@ double my_round (double);
   
 #if ! HAVE_SNPRINTF		/* GNU extension. */
 int snprintf (char *str, size_t n, char const *format, ...);
+ __attribute__ ((format (printf, 3, 4)));
 #endif
 
 #if ! HAVE_VSNPRINTF	 	/* GNU extension. */
diff --git a/flower/include/string-convert.hh b/flower/include/string-convert.hh
index 4717bfc49b..64e23e0f8b 100644
--- a/flower/include/string-convert.hh
+++ b/flower/include/string-convert.hh
@@ -31,7 +31,7 @@ public:
   static int dec2int (string dec_string);
   static double dec2double (string dec_string);
   static string double_string (double f, char const *fmt = 0);
-  static string form_string (char const *format, ...);
+  static string form_string (char const *format, ...) __attribute__ ((format (printf, 1,2)));
   static string vform_string (char const *format, va_list args);
   static int hex2int (string str);
   static unsigned hex2unsigned (string str);
diff --git a/lily/ttf.cc b/lily/ttf.cc
index 0e5526f8e1..8dfa7308f7 100644
--- a/lily/ttf.cc
+++ b/lily/ttf.cc
@@ -53,7 +53,7 @@ print_header (void *out, FT_Face face)
     = (TT_Postscript *) FT_Get_Sfnt_Table (face, ft_sfnt_post);
 
   if (pt->maxMemType42)
-    lily_cookie_fprintf (out, "%%%%VMUsage: %ld %ld\n", 0, 0);
+    lily_cookie_fprintf (out, "%%%%VMUsage: %d %d\n", 0, 0);
 
   lily_cookie_fprintf (out, "%d dict begin\n", 11);
   lily_cookie_fprintf (out, "/FontName /%s def\n",
@@ -75,8 +75,8 @@ print_header (void *out, FT_Face face)
   lily_cookie_fprintf (out, "/FontType 42 def\n");
   lily_cookie_fprintf (out, "/FontInfo 8 dict dup begin\n");
   lily_cookie_fprintf (out, "/version (%d.%d) def\n",
-		       (ht->Font_Revision >> 16),
-		       (ht->Font_Revision &((1 << 16) -1)));
+		       int (ht->Font_Revision >> 16),
+		       int (ht->Font_Revision &((1 << 16) -1)));
 
 #if 0
   if (strings[0])
-- 
2.39.5