diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-12-12 18:58:01 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-02-10 18:14:44 -0800 |
commit | 11af200b004b4810c9267e3e16449c3175c64d4a (patch) | |
tree | e2454a82fac44ea1a1f11668a3dd343ca6b311c1 | |
parent | 5e01eac10e915568324aff81b51d3af558757042 (diff) |
dmx: move format strings inline so gcc can check
Gets rid of gcc 4.8 warnings:
dmxprint.c: In function ‘dmxConfigPrintPair’:
dmxprint.c:284:25: warning: format not a string literal,
argument types not checked [-Wformat-nonliteral]
p->ysign < 0 ? '-' : '+', p->y);
^
dmxprint.c:289:9: warning: format not a string literal,
argument types not checked [-Wformat-nonliteral]
dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | hw/dmx/config/dmxprint.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/hw/dmx/config/dmxprint.c b/hw/dmx/config/dmxprint.c index 536d92bfe..c80e830e4 100644 --- a/hw/dmx/config/dmxprint.c +++ b/hw/dmx/config/dmxprint.c @@ -261,32 +261,20 @@ dmxConfigPrintString(DMXConfigStringPtr p, int quote) static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace) { - const char *format = NULL; - if (!p) return 0; - switch (p->token) { - case T_ORIGIN: - format = "@%dx%d"; - break; - case T_DIMENSION: - format = "%dx%d"; - break; - case T_OFFSET: - format = "%c%d%c%d"; - break; - } if (p->token == T_OFFSET) { if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0) return 0; - dmxConfigOutput(addSpace, 0, p->comment, format, + dmxConfigOutput(addSpace, 0, p->comment, "%c%d%c%d", p->xsign < 0 ? '-' : '+', p->x, p->ysign < 0 ? '-' : '+', p->y); } else { if (!p->comment && !p->x && !p->y) return 0; - dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y); + dmxConfigOutput(addSpace, 0, p->comment, "%s%dx%d", + (p->token == T_ORIGIN) ? "@" : "", p->x, p->y); } return 1; } |