From: claudio Date: Mon, 12 Apr 2021 17:23:30 +0000 (+0000) Subject: Cast XML_GetCurrentLineNumber() to unsigned long long in warnx since X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0ba844fda25ed36b2cdcf8530a1dba23f06eb6a7;p=openbsd Cast XML_GetCurrentLineNumber() to unsigned long long in warnx since expat my either use unsigned long or unsigened long long as return value depending on compile options. This upcast is an easy way around this issue. OK deraadt@ --- diff --git a/usr.sbin/rpki-client/rrdp.c b/usr.sbin/rpki-client/rrdp.c index 4464e503368..7f8b2d0b356 100644 --- a/usr.sbin/rpki-client/rrdp.c +++ b/usr.sbin/rpki-client/rrdp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rrdp.c,v 1.3 2021/04/07 16:29:14 claudio Exp $ */ +/* $OpenBSD: rrdp.c,v 1.4 2021/04/12 17:23:30 claudio Exp $ */ /* * Copyright (c) 2020 Nils Fisher * Copyright (c) 2021 Claudio Jeker @@ -303,18 +303,18 @@ rrdp_finished(struct rrdp *s) } if (s->res == HTTP_OK) { + XML_Parser p = s->parser; + /* * Finalize parsing on success to be sure that * all of the XML is correct. Needs to be done here * since the call would most probably fail for non * 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)) - ); + if (XML_Parse(p, NULL, 0, 1) != XML_STATUS_OK) { + warnx("%s: XML error at line %llu: %s", s->local, + (unsigned long long)XML_GetCurrentLineNumber(p), + XML_ErrorString(XML_GetErrorCode(p))); rrdp_failed(s); return; } @@ -340,16 +340,14 @@ rrdp_finished(struct rrdp *s) case SNAPSHOT: warnx("%s: downloading snapshot", s->local); - s->sxml = new_snapshot_xml(s->parser, - &s->current, s); + s->sxml = new_snapshot_xml(p, &s->current, s); s->state = RRDP_STATE_REQ; break; case DELTA: warnx("%s: downloading %lld deltas", s->local, s->repository.serial - s->current.serial); - s->dxml = new_delta_xml(s->parser, - &s->current, s); + s->dxml = new_delta_xml(p, &s->current, s); s->state = RRDP_STATE_REQ; break; } @@ -368,8 +366,7 @@ rrdp_finished(struct rrdp *s) } else { /* reset delta parser for next delta */ free_delta_xml(s->dxml); - s->dxml = new_delta_xml(s->parser, - &s->current, s); + s->dxml = new_delta_xml(p, &s->current, s); s->state = RRDP_STATE_REQ; } break; @@ -498,10 +495,10 @@ 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), + warnx("%s: parse error at line %llu: %s", s->local, + (unsigned long long)XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p))); + s->state |= RRDP_STATE_PARSE_ERROR; } }