]> git.sesse.net Git - vlc/commitdiff
DirectDraw: cleanup and document code after removing Unicode mode.
authorFelix Abecassis <felix.abecassis@gmail.com>
Tue, 21 Jan 2014 09:59:57 +0000 (10:59 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 21 Jan 2014 15:13:31 +0000 (16:13 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/video_output/msw/directx.c

index 603c247e413ebc223219d66c369e61b3d113453b..b65b14543f20c8dd5ddb08e9fd0b859711d7231a 100644 (file)
 
 #include "common.h"
 
-#ifdef UNICODE
-# warning "Unicode mode not tested"
-#endif
-
-#ifdef UNICODE
-# define DIRECTDRAWENUMERATEEX_NAME "DirectDrawEnumerateExA"
-#else
-# define DIRECTDRAWENUMERATEEX_NAME "DirectDrawEnumerateExA"
-#endif
+/* Unicode function "DirectDrawEnumerateExW" has been desactivated
+   since in some cases this function fails and the callbacks are not
+   called. If the Unicode mode is restored, one should modify the
+   prototype of the callbacks and call the FromT conversion function.
+*/
+#define DIRECTDRAWENUMERATEEX_NAME "DirectDrawEnumerateExA"
 
 /*****************************************************************************
  * Module descriptor
@@ -438,8 +435,8 @@ static void DirectXClose(vout_display_t *vd)
 }
 
 /* */
-static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
-                                            LPTSTR drivername, VOID *context,
+static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPSTR desc,
+                                            LPSTR drivername, VOID *context,
                                             HMONITOR hmon)
 {
     vout_display_t *vd = context;
@@ -453,8 +450,8 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
     if (!hmon)
         return TRUE;
 
-    char *psz_drivername = (char*)drivername;
-    char *psz_desc = (char*)desc;
+    char *psz_drivername = drivername;
+    char *psz_desc = desc;
 
     msg_Dbg(vd, "DirectXEnumCallback: %s, %s", psz_desc, psz_drivername);
 
@@ -581,7 +578,7 @@ static int DirectXOpenDDraw(vout_display_t *vd)
     }
 
     /* */
-    HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEX, LPVOID, DWORD);
+    HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, LPVOID, DWORD);
     OurDirectDrawEnumerateEx =
       (void *)GetProcAddress(sys->hddraw_dll, DIRECTDRAWENUMERATEEX_NAME);
 
@@ -1410,15 +1407,15 @@ typedef struct
 /*****************************************************************************
  * config variable callback
  *****************************************************************************/
-static BOOL WINAPI DirectXEnumCallback2(GUID *guid, LPTSTR desc,
-                                        LPTSTR drivername, VOID *data,
+static BOOL WINAPI DirectXEnumCallback2(GUID *guid, LPSTR desc,
+                                        LPSTR drivername, VOID *data,
                                         HMONITOR hmon)
 {
     enum_context_t *ctx = data;
 
     VLC_UNUSED(guid); VLC_UNUSED(desc); VLC_UNUSED(hmon);
 
-    char *psz_drivername = (char*)(drivername);
+    char *psz_drivername = drivername;
     ctx->values = xrealloc(ctx->values, (ctx->count + 1) * sizeof(char *));
     ctx->descs = xrealloc(ctx->descs, (ctx->count + 1) * sizeof(char *));
 
@@ -1445,7 +1442,7 @@ static int FindDevicesCallback(vlc_object_t *object, const char *name,
     if (hddraw_dll != NULL)
     {
         /* Enumerate displays */
-        HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEX,
+        HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA,
                                                    LPVOID, DWORD) =
               (void *)GetProcAddress(hddraw_dll, DIRECTDRAWENUMERATEEX_NAME);
         if (OurDirectDrawEnumerateEx != NULL)