diff mbox series

[FFmpeg-devel] avformat/takdec: Simplify data->hex conversion

Message ID AM7PR03MB66600895B02AB071C93E30198F6A9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 847d1991388cec36b940964de40a289b3bf97976
Headers show
Series [FFmpeg-devel] avformat/takdec: Simplify data->hex conversion | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 3, 2021, 10:49 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/takdec.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Andreas Rheinhardt Dec. 5, 2021, 11:39 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/takdec.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/takdec.c b/libavformat/takdec.c
> index 839e3cc781..6bb26683b4 100644
> --- a/libavformat/takdec.c
> +++ b/libavformat/takdec.c
> @@ -109,7 +109,7 @@ static int tak_read_header(AVFormatContext *s)
>              break;
>          case TAK_METADATA_MD5: {
>              uint8_t md5[16];
> -            int i;
> +            char md5_hex[2 * sizeof(md5) + 1];
>  
>              if (size != 19)
>                  return AVERROR_INVALIDDATA;
> @@ -121,10 +121,9 @@ static int tak_read_header(AVFormatContext *s)
>                      return AVERROR_INVALIDDATA;
>              }
>  
> -            av_log(s, AV_LOG_VERBOSE, "MD5=");
> -            for (i = 0; i < 16; i++)
> -                av_log(s, AV_LOG_VERBOSE, "%02x", md5[i]);
> -            av_log(s, AV_LOG_VERBOSE, "\n");
> +            ff_data_to_hex(md5_hex, md5, sizeof(md5), 1);
> +            md5_hex[2 * sizeof(md5)] = '\0';
> +            av_log(s, AV_LOG_VERBOSE, "MD5=%s\n", md5_hex);
>              break;
>          }
>          case TAK_METADATA_END: {
> 
Will apply tonight unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/takdec.c b/libavformat/takdec.c
index 839e3cc781..6bb26683b4 100644
--- a/libavformat/takdec.c
+++ b/libavformat/takdec.c
@@ -109,7 +109,7 @@  static int tak_read_header(AVFormatContext *s)
             break;
         case TAK_METADATA_MD5: {
             uint8_t md5[16];
-            int i;
+            char md5_hex[2 * sizeof(md5) + 1];
 
             if (size != 19)
                 return AVERROR_INVALIDDATA;
@@ -121,10 +121,9 @@  static int tak_read_header(AVFormatContext *s)
                     return AVERROR_INVALIDDATA;
             }
 
-            av_log(s, AV_LOG_VERBOSE, "MD5=");
-            for (i = 0; i < 16; i++)
-                av_log(s, AV_LOG_VERBOSE, "%02x", md5[i]);
-            av_log(s, AV_LOG_VERBOSE, "\n");
+            ff_data_to_hex(md5_hex, md5, sizeof(md5), 1);
+            md5_hex[2 * sizeof(md5)] = '\0';
+            av_log(s, AV_LOG_VERBOSE, "MD5=%s\n", md5_hex);
             break;
         }
         case TAK_METADATA_END: {