On 08/29/2018 10:39 AM, Eric Blake wrote:
The first warning is obvious:
xslt_ext.c: In function 'ipcalc_netmask':
xslt_ext.c:72:53: warning: format '%d' expects argument of type 'int',
but argument 5 has type 'long unsigned int' [-Wformat=]
"ipcalc:netmask: prefix %d not in the range 1 to
32", prefix);
~^ ~~~~~~
%ld
The second warning looks like it was intended to have a const pointer
to const contents, where the second 'const' was misplaced instead of
duplicated:
ncftool.c:96:33: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
static const struct command_def const *commands[];
^~~~~
ncftool.c:676:33: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
static const struct command_def const *commands[] = {
^~~~~
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/ncftool.c | 4 ++--
src/xslt_ext.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/ncftool.c b/src/ncftool.c
index f1b5642..382c91d 100644
--- a/src/ncftool.c
+++ b/src/ncftool.c
@@ -93,7 +93,7 @@ struct command_opt {
/* Global variables */
-static const struct command_def const *commands[];
+static const struct command_def *const commands[];
struct netcf *ncf;
static const char *const progname = "ncftool";
@@ -673,7 +673,7 @@ static int parseline(struct command *cmd, char *line) {
return 0;
}
-static const struct command_def const *commands[] = {
+static const struct command_def *const commands[] = {
&cmd_list_def,
&cmd_dump_xml_def,
&cmd_define_def,
diff --git a/src/xslt_ext.c b/src/xslt_ext.c
index fec2c21..14e5f23 100644
--- a/src/xslt_ext.c
+++ b/src/xslt_ext.c
@@ -69,6 +69,6 @@ static void ipcalc_netmask(xmlXPathParserContextPtr ctxt, int nargs) {
if (prefix == 0 || prefix > 32) {
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
- "ipcalc:netmask: prefix %d not in the range 1 to
32", prefix);
+ "ipcalc:netmask: prefix %lu not in the range 1 to
32", prefix);
goto error;
}
Ugh. mprivozn sent a patch to fix this months ago, and I ACKed it, but
forgot to push it, which I've done now.
ACK with the 2nd hunk removed.
Or if you prefer:
Reviewed-by: Laine Stump <laine(a)laine.org>