So expat has a few options that changes the ABI / API of expat.
One of them is XML_GetCurrentLineNumber() which returns a XML_Size which
is typedef-ed to unsigend long or unsigned long long depending on the
XML_LARGE_SIZE define. To work around this I just use a unsigned long long
to store the line number and with that rpki-client does not depend on
specific XML_LARGE_SIZE settings. I find this a bit neater then using a
type cast in the warnx because the lines get overly long.
There is the other issue of XML_UNICODE which changes XML_Char. This one I
will probably detect in -portable configure and just plain refuse to work
with it there. OpenBSD will never build expat with something else than
XML_Char == char.
Any opinions?
--
:wq Claudio
Index: rrdp.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/rrdp.c,v
retrieving revision 1.3
diff -u -p -r1.3 rrdp.c
--- rrdp.c 7 Apr 2021 16:29:14 -0000 1.3
+++ rrdp.c 9 Apr 2021 16:38:44 -0000
@@ -310,11 +310,11 @@ rrdp_finished(struct rrdp *s)
* successful data fetches.
*/
if (XML_Parse(s->parser, NULL, 0, 1) != XML_STATUS_OK) {
- warnx("%s: XML error at line %lu: %s",
- s->local,
- XML_GetCurrentLineNumber(s->parser),
- XML_ErrorString(XML_GetErrorCode(s->parser))
- );
+ unsigned long long line;
+
+ line = XML_GetCurrentLineNumber(s->parser),
+ warnx("%s: XML error at line %llu: %s", s->local, line,
+ XML_ErrorString(XML_GetErrorCode(s->parser)));
rrdp_failed(s);
return;
}
@@ -498,10 +498,12 @@ rrdp_data_handler(struct rrdp *s)
SHA256_Update(&s->ctx, buf, len);
if ((s->state & RRDP_STATE_PARSE_ERROR) == 0 &&
XML_Parse(p, buf, len, 0) != XML_STATUS_OK) {
- s->state |= RRDP_STATE_PARSE_ERROR;
- warnx("%s: parse error at line %lu: %s", s->local,
- XML_GetCurrentLineNumber(p),
+ unsigned long long line;
+
+ line = XML_GetCurrentLineNumber(p);
+ warnx("%s: parse error at line %llu: %s", s->local, line,
XML_ErrorString(XML_GetErrorCode(p)));
+ s->state |= RRDP_STATE_PARSE_ERROR;
}
}