[PATCH:xfs 2/4] Fix printf format errors found by gcc now that it can check
Alan Coopersmith
alan.coopersmith at oracle.com
Fri Nov 11 22:49:08 PST 2011
Fixes:
os/config.c: In function ‘config_parse_nameVal’:
os/config.c:417:5: warning: too few arguments for format
os/config.c: In function ‘config_parse_int’:
os/config.c:458:6: warning: too few arguments for format
Requires passing parm arguments around in order to provide parameter
names with problems in the error messages
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
os/config.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/os/config.c b/os/config.c
index 809a3fa..67bc7ad 100644
--- a/os/config.c
+++ b/os/config.c
@@ -390,6 +390,7 @@ struct nameVal {
static char *
config_parse_nameVal (
+ ConfigOptionPtr parm,
char *c,
int *ret,
int *pval,
@@ -414,7 +415,7 @@ config_parse_nameVal (
return c;
}
}
- ErrorF(CONFIG_ERR_VALUE, start);
+ ErrorF(CONFIG_ERR_VALUE, start, parm->parm_name);
*c = t;
*ret = -1;
return c;
@@ -422,6 +423,7 @@ config_parse_nameVal (
static char *
config_parse_bool (
+ ConfigOptionPtr parm,
char *c,
int *ret,
Bool *pval)
@@ -437,11 +439,12 @@ config_parse_bool (
{ "false", FALSE },
{ (char *) 0, 0 },
};
- return config_parse_nameVal (c, ret, pval, bool_val);
+ return config_parse_nameVal (parm, c, ret, pval, bool_val);
}
static char *
config_parse_int(
+ ConfigOptionPtr parm,
char *c,
int *ret,
int *pval)
@@ -455,7 +458,7 @@ config_parse_int(
skip_val(c);
t = *c;
*c = '\0';
- ErrorF(CONFIG_ERR_VALUE, start);
+ ErrorF(CONFIG_ERR_VALUE, start, parm->parm_name);
*ret = -1;
*c = t;
return c;
@@ -481,7 +484,7 @@ config_set_int(
int ival,
ret;
- val = config_parse_int(val, &ret, &ival);
+ val = config_parse_int(parm, val, &ret, &ival);
if (ret == -1)
return val;
@@ -505,7 +508,7 @@ config_set_bool(
ret;
Bool bval;
- val = config_parse_bool(val, &ret, &bval);
+ val = config_parse_bool(parm, val, &ret, &bval);
if (ret == -1)
return val;
@@ -641,6 +644,7 @@ config_set_resolutions(
static char *
config_parse_endian(
+ ConfigOptionPtr parm,
char *c,
int *ret,
int *pval)
@@ -654,7 +658,7 @@ config_parse_endian(
{ "msbfirst", MSBFirst },
{ (char *) 0, 0 },
};
- return config_parse_nameVal (c, ret, pval, endian_val);
+ return config_parse_nameVal (parm, c, ret, pval, endian_val);
}
/* ARGSUSED */
@@ -666,19 +670,19 @@ config_set_snf_format (
int bit, byte, glyph, scan;
int ret;
- val = config_parse_endian (val, &ret, &bit);
+ val = config_parse_endian (parm, val, &ret, &bit);
if (ret == -1)
return val;
skip_whitespace (val);
- val = config_parse_endian (val, &ret, &byte);
+ val = config_parse_endian (parm, val, &ret, &byte);
if (ret == -1)
return val;
skip_whitespace (val);
- val = config_parse_int (val, &ret, &glyph);
+ val = config_parse_int (parm, val, &ret, &glyph);
if (ret == -1)
return val;
skip_whitespace (val);
- val = config_parse_int (val, &ret, &scan);
+ val = config_parse_int (parm, val, &ret, &scan);
if (ret == -1)
return val;
SnfSetFormat (bit, byte, glyph, scan);
--
1.7.3.2
More information about the xorg-devel
mailing list