[vlc-devel] commit: taglib: Fix opening of filenames on non-UTF8 systems. ( Derk-Jan Hartman )

Derk-Jan Hartman hartman at videolan.org
Mon Aug 18 01:07:58 CEST 2008


On 17 aug 2008, at 18:41, Rémi Denis-Courmont wrote:
> Le dimanche 17 août 2008 19:10:51 git version control, vous avez  
> écrit :
>> +        wchar_t wpath[MAX_PATH + 1];
>> +        if( !MultiByteToWideChar( CP_UTF8, 0, p_demux->psz_path, -1,
>> wpath, MAX_PATH) ) +        {
>> +            errno = ENOENT;
>> +            return VLC_EGENERIC;
>> +        }
>> +        wpath[MAX_PATH] = L'0';
>> +        FileRef f( wpath );
>
> Err hmm, are you sure taglib expects wide character file names on  
> Win32 ??
> Looks very odd.

FileRef expects a FileName as argument.

 From <taglib/tfile.h>

#ifdef _WIN32
   class TAGLIB_EXPORT FileName
   {
   public:
     FileName(const wchar_t *name) : m_wname(name) {}
     FileName(const char *name) : m_name(name) {}
     operator const wchar_t *() const { return m_wname.c_str(); }
     operator const char *() const { return m_name.c_str(); }
   private:
     std::string m_name;
     std::wstring m_wname;
   };
#else
   typedef const char *FileName;
#endif




More information about the vlc-devel mailing list