aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@netbsd.org>2014-01-05 19:10:56 +0000
committerJoerg Sonnenberger <joerg@netbsd.org>2014-01-05 19:10:56 +0000
commitd9597fb775134ff4c4ae106fdb7f3214b5af2463 (patch)
treedce4ca23417904d6be1f14b7df1868abe7ff2eb3
parent1e7939918df65f9471cdc0622fe36a0ff3a6ebc9 (diff)
downloadmandoc-d9597fb775134ff4c4ae106fdb7f3214b5af2463.tar.gz
mandoc-d9597fb775134ff4c4ae106fdb7f3214b5af2463.tar.zst
mandoc-d9597fb775134ff4c4ae106fdb7f3214b5af2463.zip
Tag functions with format strings as arguments as printf-like.
Fix one case where a non-literal is used as format string. Fix another case where a variable is formatted using the wrong type.
-rw-r--r--html.c4
-rw-r--r--html.h5
-rw-r--r--libmandoc.h5
-rw-r--r--term_ps.c7
4 files changed, 15 insertions, 6 deletions
diff --git a/html.c b/html.c
index 9d28b427..30ed53e4 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.152 2013/08/08 20:07:47 schwarze Exp $ */
+/* $Id: html.c,v 1.153 2014/01/05 19:10:56 joerg Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -722,7 +722,7 @@ buffmt_man(struct html *h,
bufcat(h, sec ? sec : "1");
break;
case('N'):
- bufcat_fmt(h, name);
+ bufcat_fmt(h, "%s", name);
break;
default:
bufncat(h, p, 2);
diff --git a/html.h b/html.h
index 894cfc4c..9b96b9e6 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.49 2013/08/08 20:07:47 schwarze Exp $ */
+/* $Id: html.h,v 1.50 2014/01/05 19:10:56 joerg Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -147,6 +147,9 @@ void print_tblclose(struct html *);
void print_tbl(struct html *, const struct tbl_span *);
void print_eqn(struct html *, const struct eqn *);
+#if __GNUC__ - 0 >= 4
+__attribute__((__format__ (__printf__, 2, 3)))
+#endif
void bufcat_fmt(struct html *, const char *, ...);
void bufcat(struct html *, const char *);
void bufcat_id(struct html *, const char *);
diff --git a/libmandoc.h b/libmandoc.h
index 192346a0..ab243ff9 100644
--- a/libmandoc.h
+++ b/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.36 2013/12/31 23:23:10 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.37 2014/01/05 19:10:56 joerg Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -38,6 +38,9 @@ struct man;
void mandoc_msg(enum mandocerr, struct mparse *,
int, int, const char *);
+#if __GNUC__ - 0 >= 4
+__attribute__((__format__ (__printf__, 5, 6)))
+#endif
void mandoc_vmsg(enum mandocerr, struct mparse *,
int, int, const char *, ...);
char *mandoc_getarg(struct mparse *, char **, int, int *);
diff --git a/term_ps.c b/term_ps.c
index e8a90685..b464b842 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.54 2011/10/16 12:20:34 schwarze Exp $ */
+/* $Id: term_ps.c,v 1.55 2014/01/05 19:10:56 joerg Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -97,6 +97,9 @@ static void ps_growbuf(struct termp *, size_t);
static void ps_letter(struct termp *, int);
static void ps_pclose(struct termp *);
static void ps_pletter(struct termp *, int);
+#if __GNUC__ - 0 >= 4
+__attribute__((__format__ (__printf__, 2, 3)))
+#endif
static void ps_printf(struct termp *, const char *, ...);
static void ps_putchar(struct termp *, char);
static void ps_setfont(struct termp *, enum termfont);
@@ -824,7 +827,7 @@ ps_begin(struct termp *p)
ps_printf(p, "<<\n");
ps_printf(p, "/Type /Font\n");
ps_printf(p, "/Subtype /Type1\n");
- ps_printf(p, "/Name /F%zu\n", i);
+ ps_printf(p, "/Name /F%d\n", i);
ps_printf(p, "/BaseFont /%s\n", fonts[i].name);
ps_printf(p, ">>\n");
}