From 8989b3a54de997f59281aef90ae4a4660ef0d077 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 5 Oct 2022 09:24:26 +0200 Subject: [PATCH] virNodeDevCapsDefParseHexId: Use 'virXPathUIntBase' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch to the proper function for parsing integer variant of a hex number via XPath and spell out properly that the argument is 'unsigned int'. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/conf/node_device_conf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 1e3565dafc..83e66b85e3 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1808,15 +1808,14 @@ virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt, static int virNodeDevCapsDefParseHexId(const char *xpath, xmlXPathContextPtr ctxt, - unsigned *value, + unsigned int *value, virNodeDeviceDef *def, const char *missing_error_fmt, const char *invalid_error_fmt) { int ret; - unsigned long val; - ret = virXPathULongHex(xpath, ctxt, &val); + ret = virXPathUIntBase(xpath, ctxt, 16, value); if (ret < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, ret == -1 ? missing_error_fmt : invalid_error_fmt, @@ -1824,7 +1823,6 @@ virNodeDevCapsDefParseHexId(const char *xpath, return -1; } - *value = val; return 0; }