[PATCH] taglib: Opening a file for reading if possible

Aleksey Vasenev <[email protected]>
Newsgroups gmane.comp.video.videolan.vlc.devel
Message-ID <[email protected]>
For 3.0.x branch

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
https://mailman.videolan.org/listinfo/vlc-devel
0001-taglib-Opening-a-file-for-reading-if-possible.patch (text/x-patch, 1.5 KB)
From 5ea933919e0393ffd974bbe26dbf03ac8ab32490 Mon Sep 17 00:00:00 2001
From: Aleksey Vasenev <[email protected]>
Date: Tue, 14 Feb 2023 00:27:05 +0530
Subject: [PATCH] taglib: Opening a file for reading if possible

When metadata is read, the file is opened for writing. This causes the
file to be deleted in FS-Cache when caching network file systems.

Fixes #27848
---
 modules/meta_engine/taglib.cpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 123d09c94f..02d1f2dcdc 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -58,6 +58,9 @@
 
 #define TAGLIB_VERSION_1_11 VERSION_INT(1,11,0)
 
+#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11
+#include <tfilestream.h>
+#endif
 #include <fileref.h>
 #include <tag.h>
 #include <tbytevector.h>
@@ -872,11 +875,21 @@ static int ReadMeta( vlc_object_t* p_this)
         free( psz_path );
         return VLC_EGENERIC;
     }
+#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11
+    FileStream stream( wpath, true );
+    f = FileRef( &stream );
+#else /* TAGLIB_VERSION */
     f = FileRef( wpath );
+#endif /* TAGLIB_VERSION */
     free( wpath );
-#else
+#else /* _WIN32 */
+#if TAGLIB_VERSION >= TAGLIB_VERSION_1_11
+    FileStream stream( psz_path, true );
+    f = FileRef( &stream );
+#else /* TAGLIB_VERSION */
     f = FileRef( psz_path );
-#endif
+#endif /* TAGLIB_VERSION */
+#endif /* _WIN32 */
     free( psz_path );
 #endif /* VLC_WINSTORE_APP */
 
-- 
2.30.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.