Skip to content

Commit

Permalink
Fix XML generation with context attributes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pcercuei committed Jul 2, 2021
1 parent 835d75a commit 52e6dc3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 52e6dc3

Please sign in to comment.