realityking / mp4v2

Automatically exported from code.google.com/p/mp4v2
Other
0 stars 0 forks source link

File name containing high ASCII characters cannot be parsed on Windows #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
E.g a file named "07 Ravel_ Pièce En Forme De Habañera.m4a" will be 
correctly open (the current mp4v2 code does the correct thing to open the 
file under Win32). However it will fail soon after calling 
GetFileAttributesExA

We have done the following fix:

Index: 
D:/BUILDS/Work/project/branches/desktop4/External/mp4v2/libplatform/io/File
System_win32.cpp
===================================================================
--- 
D:/BUILDS/Work/project/branches/desktop4/External/mp4v2/libplatform/io/File
System_win32.cpp    (revision 22882)
+++ 
D:/BUILDS/Work/project/branches/desktop4/External/mp4v2/libplatform/io/File
System_win32.cpp    (revision 22883)
@@ -48,8 +48,17 @@
 {
     size_ = 0;
     WIN32_FILE_ATTRIBUTE_DATA data;
-    if( !GetFileAttributesExA( path_.c_str(), GetFileExInfoStandard, 
(LPVOID)&data ))
+
+#ifdef AMBIENT_CHAR_INSTEAD_OF_UTF8
+   if( !GetFileAttributesExA( path_.c_str(), GetFileExInfoStandard, 
(LPVOID)&data ))
         return true;
+#else
+   wchar_t buffer[MAX_PATH + 1];
+    MultiByteToWideChar(CP_UTF8, 0, path_.c_str(), -1, buffer, (int) 
MAX_PATH);
+   if( !GetFileAttributesExW(buffer, GetFileExInfoStandard, (LPVOID)
&data ))
+        return true;
+#endif
+
     size_ = ((File::Size)data.nFileSizeHigh << 32) | data.nFileSizeLow;
     return false;
 }

Original issue reported on code.google.com by saint...@gmail.com on 19 Feb 2010 at 1:35

GoogleCodeExporter commented 9 years ago
This is pretty much a duplicate of 48; I'm going to be looking more at this 
issue in
the next few days.

Original comment by kid...@gmail.com on 2 Apr 2010 at 12:46