From b8a4fec22f8c625b9fa5f48ebb135a4251fb95cd Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Sat, 12 Jun 2010 01:48:45 +0200 Subject: Use string literals as format strings Allows gcc to check argument types, and avoids warnings: xlsfonts.c:632: warning: format not a string literal, argument types not checked --- xlsfonts.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'xlsfonts.c') diff --git a/xlsfonts.c b/xlsfonts.c index d67a1ac..aafca51 100644 --- a/xlsfonts.c +++ b/xlsfonts.c @@ -416,15 +416,11 @@ int IgnoreError(Display *disp, XErrorEvent *event) static char *bounds_metrics_title = "width left right asc desc attr keysym\n"; -static char *char_metrics_fmt = -"\t0x%02x%02x (%u)\t%4d %4d %4d %4d %4d 0x%04x %s\n"; -static char *bounds_metrics_fmt = -"\t%3s\t\t%4d %4d %4d %4d %4d 0x%04x\n"; - #define PrintBounds(_what,_ptr) \ { register XCharStruct *p = (_ptr); \ - printf (bounds_metrics_fmt, (_what), p->width, p->lbearing, \ + printf ("\t%3s\t\t%4d %4d %4d %4d %4d 0x%04x\n", \ + (_what), p->width, p->lbearing, \ p->rbearing, p->ascent, p->descent, p->attributes); } @@ -589,7 +585,8 @@ print_character_metrics(register XFontStruct *info) n = saven; for (i = info->min_char_or_byte2; i <= info->max_char_or_byte2; i++) { char *s = XKeysymToString ((KeySym) n); - printf (char_metrics_fmt, j, i, n, pc->width, pc->lbearing, + printf ("\t0x%02x%02x (%u)\t%4d %4d %4d %4d %4d 0x%04x %s\n", + j, i, n, pc->width, pc->lbearing, pc->rbearing, pc->ascent, pc->descent, pc->attributes, s ? s : "."); pc++; -- cgit v1.2.3