From 52e6dc318db8958e80f03de8333a340e705565ab Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 2 Jul 2021 10:51:53 +0100 Subject: [PATCH] Fix XML generation with context attributes Looks like the previous code hasn't been tested... This fixes the generation of the XML representation of the context when context attributes are present. It additionally removes whitespace characters in two blank lines. Signed-off-by: Paul Cercueil --- context.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/context.c b/context.c index c8af7dd14..08dfdea28 100644 --- a/context.c +++ b/context.c @@ -81,13 +81,13 @@ ssize_t iio_xml_print_and_sanitized_param(char *ptr, ssize_t len, if (ret < 0) return ret; iio_update_xml_indexes(ret, &ptr, &len, &alen); - + /* Print param */ ret = sanitize_xml(ptr, len, param); if (ret < 0) return ret; iio_update_xml_indexes(ret, &ptr, &len, &alen); - + /* Print after */ ret = iio_snprintf(ptr, len, "%s", after); if (ret < 0) @@ -122,6 +122,8 @@ static ssize_t iio_snprintf_context_xml(char *ptr, ssize_t len, if (ret < 0) return ret; + iio_update_xml_indexes(ret, &ptr, &len, &alen); + ret = iio_xml_print_and_sanitized_param(ptr, len, "value=\"", ctx->values[i],