diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-02-22 01:09:24 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-02-25 02:19:18 +0100 |
commit | 08328463d51b9fb4f38aa7a2342825230049547c (patch) | |
tree | d34d6546168a1bca26a7a25e855deb789f8ad22b /fftools | |
parent | ed5bf403d7b56f2e882f111e96aab4dc6161a558 (diff) | |
download | ffmpeg-08328463d51b9fb4f38aa7a2342825230049547c.tar.gz |
fftools/ffprobe: Simplify printing xml values
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools')
-rw-r--r-- | fftools/ffprobe.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index e63935baba..31081d19e2 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -1860,7 +1860,8 @@ static void xml_print_section_footer(WriterContext *wctx) } } -static void xml_print_value(WriterContext *wctx, const char *key, const void *value, const int is_int) +static void xml_print_value(WriterContext *wctx, const char *key, + const char *str, long long int num, const int is_int) { AVBPrint buf; XMLContext *xml = wctx->priv; @@ -1878,9 +1879,9 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va av_bprint_clear(&buf); if (is_int) { - writer_printf(wctx, " value=\"%lld\"/>\n", *(long long int *)value); + writer_printf(wctx, " value=\"%lld\"/>\n", num); } else { - av_bprint_escape(&buf, (const char *)value, NULL, + av_bprint_escape(&buf, str, NULL, AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES); writer_printf(wctx, " value=\"%s\"/>\n", buf.str); } @@ -1890,9 +1891,9 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va writer_w8(wctx, ' '); if (is_int) { - writer_printf(wctx, "%s=\"%lld\"", key, *(long long int *)value); + writer_printf(wctx, "%s=\"%lld\"", key, num); } else { - av_bprint_escape(&buf, (const char *)value, NULL, + av_bprint_escape(&buf, str, NULL, AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES); writer_printf(wctx, "%s=\"%s\"", key, buf.str); } @@ -1902,11 +1903,11 @@ static void xml_print_value(WriterContext *wctx, const char *key, const void *va } static inline void xml_print_str(WriterContext *wctx, const char *key, const char *value) { - xml_print_value(wctx, key, (const void *)value, 0); + xml_print_value(wctx, key, value, 0, 0); } static inline void xml_print_int(WriterContext *wctx, const char *key, long long int value) { - xml_print_value(wctx, key, (const void *)&value, 1); + xml_print_value(wctx, key, NULL, value, 1); } static Writer xml_writer = { |