diff mbox series

[FFmpeg-devel,3/4] fftools/ffprobe: Simplify printing xml values

Message ID AS8P250MB0744F530DA98D22F435121BB8F562@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 08328463d51b9fb4f38aa7a2342825230049547c
Headers show
Series [FFmpeg-devel,1/4] fftools/ffprobe: Don't cast const away needlessly | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 22, 2024, 12:33 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffprobe.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

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 = {