[vlc-commits] preparser: art: use new md5 API

Marvin Scholz git at videolan.org
Thu Apr 16 12:11:42 CEST 2020


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Apr  1 16:20:36 2020 +0200| [b22ca2c82ab25735de620056b1ab8cec780ebf49] | committer: Marvin Scholz

preparser: art: use new md5 API

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b22ca2c82ab25735de620056b1ab8cec780ebf49
---

 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..b7f0d48411 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_FinishHex( &md5, psz_arturl_sanitized );
         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;



More information about the vlc-commits mailing list