[vlc-commits] [Git][videolan/vlc][master] fetcher: don't mark fetched as false on success

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jan 30 11:07:02 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
9e3e0edd by Steve Lhomme at 2024-01-30T10:42:33+00:00
fetcher: don't mark fetched as false on success

On success the code in the error label was used, resulting in a failed
status reported.

Now we assume it failed by default and set to success on success.

- - - - -


1 changed file:

- src/preparser/fetcher.c


Changes:

=====================================
src/preparser/fetcher.c
=====================================
@@ -303,7 +303,7 @@ static void RunDownloader(void *userdata)
 {
     vlc_thread_set_name("vlc-run-fetcher");
 
-    bool fetched = true;
+    bool fetched = false;
     struct task *task = userdata;
     input_fetcher_t *fetcher = task->fetcher;
 
@@ -313,16 +313,19 @@ static void RunDownloader(void *userdata)
 
     char *psz_arturl = input_item_GetArtURL( task->item );
     if( !psz_arturl )
-        goto error;
+        goto out;
 
     if( !strncasecmp( psz_arturl, "file://", 7 ) ||
         !strncasecmp( psz_arturl, "attachment://", 13 ) )
+    {
+        fetched = true;
         goto out; /* no fetch required */
+    }
 
     stream_t* source = vlc_stream_NewURL( fetcher->owner, psz_arturl );
 
     if( !source )
-        goto error;
+        goto out;
 
     struct vlc_memstream output_stream;
     vlc_memstream_open( &output_stream );
@@ -342,12 +345,12 @@ static void RunDownloader(void *userdata)
     vlc_stream_Delete( source );
 
     if( vlc_memstream_close( &output_stream ) )
-        goto error;
+        goto out;
 
     if( vlc_killed() )
     {
         free( output_stream.ptr );
-        goto error;
+        goto out;
     }
 
     input_SaveArt( fetcher->owner, task->item, output_stream.ptr,
@@ -355,9 +358,8 @@ static void RunDownloader(void *userdata)
 
     free( output_stream.ptr );
     AddAlbumCache( fetcher, task->item, true );
+    fetched = true;
 
-error:
-    fetched = false;
 out:
     vlc_interrupt_set(NULL);
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9e3e0eddda9ab8559ed52f75d3baadc7abec9b86

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9e3e0eddda9ab8559ed52f75d3baadc7abec9b86
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list