[vlc-commits] taglib: support long paths on Win32

Rémi Denis-Courmont git at videolan.org
Tue Jul 12 19:09:32 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 12 20:08:45 2011 +0300| [2ea309908f97321cfdd1df127830f0769f84250b] | committer: Rémi Denis-Courmont

taglib: support long paths on Win32

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

 modules/meta_engine/taglib.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 81389f9..0f2fb57 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -447,14 +447,14 @@ static int ReadMeta( vlc_object_t* p_this)
         return VLC_ENOMEM;
 
 #if defined(WIN32) || defined (UNDER_CE)
-    wchar_t wpath[MAX_PATH + 1];
-    if( !MultiByteToWideChar( CP_UTF8, 0, psz_path, -1, wpath, MAX_PATH) )
+    wchar_t *wpath = ToWide( psz_path );
+    if( wpath == NULL )
     {
         free( psz_path );
         return VLC_EGENERIC;
     }
-    wpath[MAX_PATH] = L'\0';
     f = FileRef( wpath );
+    free( wpath );
 #else
     const char* local_name = ToLocale( psz_path );
     if( !local_name )
@@ -679,11 +679,11 @@ static int WriteMeta( vlc_object_t *p_this )
     }
 
 #if defined(WIN32) || defined (UNDER_CE)
-    wchar_t wpath[MAX_PATH + 1];
-    if( !MultiByteToWideChar( CP_UTF8, 0, p_export->psz_file, -1, wpath, MAX_PATH) )
+    wchar_t *wpath = ToWide( p_export->psz_file );
+    if( wpath == NULL )
         return VLC_EGENERIC;
-    wpath[MAX_PATH] = L'\0';
     f = FileRef( wpath );
+    free( wpath );
 #else
     const char* local_name = ToLocale( p_export->psz_file );
     if( !local_name )



More information about the vlc-commits mailing list