[MPlayer-cvslog] r34481 - trunk/gui/win32/interface.c

ib subversion at mplayerhq.hu
Sat Dec 31 14:42:24 CET 2011


Author: ib
Date: Sat Dec 31 14:42:24 2011
New Revision: 34481

Log:
Cosmetic: Collect together Wine port related functions.

Modified:
   trunk/gui/win32/interface.c

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Sat Dec 31 14:25:23 2011	(r34480)
+++ trunk/gui/win32/interface.c	Sat Dec 31 14:42:24 2011	(r34481)
@@ -83,6 +83,42 @@ mixer_t *mixer = NULL;
 
 #ifdef __WINE__
 /**
+ * @brief Convert a Windows style path to a file name into an Unix style one.
+ *
+ * @param filename pointer to the file path to be converted
+ *
+ * @return pointer to the converted file path
+ */
+static char *unix_name (char *filename)
+{
+    static char *unix_filename;
+    LPSTR (*CDECL wine_get_unix_file_name_ptr)(LPCWSTR);
+    int wchar_conv;
+
+    if (*filename && (filename[1] == ':'))
+    {
+        wine_get_unix_file_name_ptr = (void *) GetProcAddress(GetModuleHandleA("KERNEL32"), "wine_get_unix_file_name");
+        wchar_conv = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0);
+
+        if (wine_get_unix_file_name_ptr && wchar_conv)
+        {
+            WCHAR *ntpath;
+            char *unix_name;
+
+            ntpath = HeapAlloc(GetProcessHeap(), 0, sizeof(*ntpath) * (wchar_conv + 1));
+            MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, ntpath, wchar_conv);
+            unix_name = wine_get_unix_file_name_ptr(ntpath);
+            setdup(&unix_filename, unix_name);
+            filename = unix_filename;
+            HeapFree(GetProcessHeap(), 0, unix_name);
+            HeapFree(GetProcessHeap(), 0, ntpath);
+        }
+    }
+
+    return filename;
+}
+
+/**
  * @brief Convert a Windows style device name into an Unix style one.
  *
  * @param device pointer to the device name to be converted
@@ -388,44 +424,6 @@ void uiPrev(void)
     mygui->startplay(mygui);
 }
 
-#ifdef __WINE__
-/**
- * @brief Convert a Windows style path to a file name into an Unix style one.
- *
- * @param filename pointer to the file path to be converted
- *
- * @return pointer to the converted file path
- */
-static char *unix_name (char *filename)
-{
-    static char *unix_filename;
-    LPSTR (*CDECL wine_get_unix_file_name_ptr)(LPCWSTR);
-    int wchar_conv;
-
-    if (*filename && (filename[1] == ':'))
-    {
-        wine_get_unix_file_name_ptr = (void *) GetProcAddress(GetModuleHandleA("KERNEL32"), "wine_get_unix_file_name");
-        wchar_conv = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0);
-
-        if (wine_get_unix_file_name_ptr && wchar_conv)
-        {
-            WCHAR *ntpath;
-            char *unix_name;
-
-            ntpath = HeapAlloc(GetProcessHeap(), 0, sizeof(*ntpath) * (wchar_conv + 1));
-            MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, ntpath, wchar_conv);
-            unix_name = wine_get_unix_file_name_ptr(ntpath);
-            setdup(&unix_filename, unix_name);
-            filename = unix_filename;
-            HeapFree(GetProcessHeap(), 0, unix_name);
-            HeapFree(GetProcessHeap(), 0, ntpath);
-        }
-    }
-
-    return filename;
-}
-#endif
-
 void uiSetFileName(char *dir, char *name, int type)
 {
     if(!name) return;


More information about the MPlayer-cvslog mailing list