[FFmpeg-cvslog] fftools/ffprobe: Simplify printing xml values

Andreas Rheinhardt git at videolan.org
Sun Feb 25 03:41:06 EET 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Feb 22 01:09:24 2024 +0100| [08328463d51b9fb4f38aa7a2342825230049547c] | committer: Andreas Rheinhardt

fftools/ffprobe: Simplify printing xml values

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=08328463d51b9fb4f38aa7a2342825230049547c
---

 fftools/ffprobe.c | 15 ++++++++-------
 1 file 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 = {



More information about the ffmpeg-cvslog mailing list