[vlc-devel] [PATCH v3 11/14] preparser: art: use new md5 API

Marvin Scholz epirat07 at gmail.com
Wed Apr 8 16:10:21 CEST 2020


---
 src/preparser/art.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/preparser/art.c b/src/preparser/art.c
index f7dabbd725..082a04b872 100644
--- a/src/preparser/art.c
+++ b/src/preparser/art.c
@@ -33,7 +33,7 @@
 #include <vlc_fs.h>
 #include <vlc_strings.h>
 #include <vlc_url.h>
-#include <vlc_md5.h>
+#include <vlc_hash.h>
 
 #include "art.h"
 
@@ -107,17 +107,17 @@ static char* ArtCacheGetDirPath( const char *psz_arturl, const char *psz_artist,
          * (We should never need to call this function if art has already been
          * downloaded anyway).
          */
-        struct md5_s md5;
-        InitMD5( &md5 );
-        AddMD5( &md5, psz_arturl, strlen( psz_arturl ) );
+        char psz_arturl_sanitized[VLC_HASH_MD5_DIGEST_HEX_SIZE];
+
+        vlc_hash_md5_t md5;
+        vlc_hash_md5_Init( &md5 );
+        vlc_hash_md5_Update( &md5, psz_arturl, strlen( psz_arturl ) );
         if( !strncmp( psz_arturl, "attachment://", 13 ) )
-            AddMD5( &md5, psz_title, strlen( psz_title ) );
-        EndMD5( &md5 );
-        char * psz_arturl_sanitized = psz_md5_hash( &md5 );
+            vlc_hash_md5_Update( &md5, psz_title, strlen( psz_title ) );
+        vlc_hash_md5_FinishHex( &md5, psz_arturl_sanitized, VLC_HASH_MD5_DIGEST_HEX_SIZE );
         if( asprintf( &psz_dir, "%s" DIR_SEP "art" DIR_SEP "arturl" DIR_SEP
                       "%s", psz_cachedir, psz_arturl_sanitized ) == -1 )
             psz_dir = NULL;
-        free( psz_arturl_sanitized );
     }
     free( psz_cachedir );
     return psz_dir;
-- 
2.24.1 (Apple Git-126)



More information about the vlc-devel mailing list