[FFmpeg-devel] [PATCH 10/17] avformat/mxfdec: Simplify data->hex string conversion

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Nov 9 20:01:48 EET 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavformat/mxfdec.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index af9d33f796..4191e82474 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1984,22 +1984,15 @@ static int mxf_uid_to_str(UID uid, char **str)
 
 static int mxf_umid_to_str(UID ul, UID uid, char **str)
 {
-    int i;
     char *p;
     p = *str = av_mallocz(sizeof(UID) * 4 + 2 + 1);
     if (!p)
         return AVERROR(ENOMEM);
     snprintf(p, 2 + 1, "0x");
     p += 2;
-    for (i = 0; i < sizeof(UID); i++) {
-        snprintf(p, 2 + 1, "%.2X", ul[i]);
-        p += 2;
-
-    }
-    for (i = 0; i < sizeof(UID); i++) {
-        snprintf(p, 2 + 1, "%.2X", uid[i]);
-        p += 2;
-    }
+    ff_data_to_hex(p, ul,  sizeof(UID), 0);
+    p += 2 * sizeof(UID);
+    ff_data_to_hex(p, uid, sizeof(UID), 0);
     return 0;
 }
 
-- 
2.30.2



More information about the ffmpeg-devel mailing list