[vlc-commits] DirectDraw: port to UNICODE friendly APIs
Jean-Baptiste Kempf
git at videolan.org
Tue Jan 15 01:00:09 CET 2013
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Jan 15 00:59:33 2013 +0100| [46b26be576cd2ea9046a1b4e939a61d8eed3e1c2] | committer: Jean-Baptiste Kempf
DirectDraw: port to UNICODE friendly APIs
This would need more testing and close look
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=46b26be576cd2ea9046a1b4e939a61d8eed3e1c2
---
modules/video_output/msw/directx.c | 24 +++++++++++++-----------
modules/video_output/msw/events.c | 6 +++---
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
index fc881ac..61c1cb4 100644
--- a/modules/video_output/msw/directx.c
+++ b/modules/video_output/msw/directx.c
@@ -52,7 +52,7 @@
#include "common.h"
#ifdef UNICODE
-# error "Unicode mode not supported"
+# warning "Unicode mode not tested"
#endif
/*****************************************************************************
@@ -446,12 +446,14 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
if (!hmon)
return TRUE;
- msg_Dbg(vd, "DirectXEnumCallback: %s, %s", desc, drivername);
+ char *psz_drivername = FromT(drivername);
+
+ msg_Dbg(vd, "DirectXEnumCallback: %s, %s", FromT(desc), psz_drivername);
char *device = var_GetString(vd, "directx-device");
/* Check for forced device */
- if (device && *device && !strcmp(drivername, device)) {
+ if (device && *device && !strcmp(psz_drivername, device)) {
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(MONITORINFO);
@@ -475,7 +477,7 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
free(device);
if (hmon == sys->hmonitor) {
- msg_Dbg(vd, "selecting %s, %s", desc, drivername);
+ msg_Dbg(vd, "selecting %s, %s", FromT(desc), psz_drivername);
free(sys->display_driver);
sys->display_driver = malloc(sizeof(*guid));
@@ -564,16 +566,16 @@ static int DirectXOpenDDraw(vout_display_t *vd)
/* */
HRESULT (WINAPI *OurDirectDrawCreate)(GUID *,LPDIRECTDRAW *,IUnknown *);
OurDirectDrawCreate =
- (void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawCreate"));
+ (void *)GetProcAddress(sys->hddraw_dll, "DirectDrawCreate");
if (!OurDirectDrawCreate) {
msg_Err(vd, "DirectXInitDDraw failed GetProcAddress");
return VLC_EGENERIC;
}
/* */
- HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA, LPVOID, DWORD);
+ HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEX, LPVOID, DWORD);
OurDirectDrawEnumerateEx =
- (void *)GetProcAddress(sys->hddraw_dll, _T("DirectDrawEnumerateExA"));
+ (void *)GetProcAddress(sys->hddraw_dll, "DirectDrawEnumerateEx");
if (OurDirectDrawEnumerateEx) {
char *device = var_GetString(vd, "directx-device");
@@ -1425,8 +1427,8 @@ static BOOL WINAPI DirectXEnumCallback2(GUID *guid, LPTSTR desc,
ctx->descs = xrealloc(ctx->descs, (ctx->count + 1) * sizeof(char *));
/* TODO? Unicode APIs */
- ctx->values[ctx->count] = FromANSI(drivername);
- ctx->descs[ctx->count] = FromANSI(drivername);
+ ctx->values[ctx->count] = FromT(drivername);
+ ctx->descs[ctx->count] = FromT(drivername);
ctx->count++;
return TRUE; /* Keep enumerating */
@@ -1448,9 +1450,9 @@ static int FindDevicesCallback(vlc_object_t *object, const char *name,
if (hddraw_dll != NULL)
{
/* Enumerate displays */
- HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEXA,
+ HRESULT (WINAPI *OurDirectDrawEnumerateEx)(LPDDENUMCALLBACKEX,
LPVOID, DWORD) =
- (void *)GetProcAddress(hddraw_dll, _T("DirectDrawEnumerateExA"));
+ (void *)GetProcAddress(hddraw_dll, "DirectDrawEnumerateEx");
if (OurDirectDrawEnumerateEx != NULL)
OurDirectDrawEnumerateEx(DirectXEnumCallback2, &ctx,
DDENUM_ATTACHEDSECONDARYDEVICES);
diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index e671fcd..9859a3a 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -499,7 +499,7 @@ static int DirectXCreateWindow( event_thread_t *p_event )
HMENU hMenu;
RECT rect_window;
WNDCLASS wc; /* window class components */
- char vlc_path[MAX_PATH+1];
+ TCHAR vlc_path[MAX_PATH+1];
int i_style, i_stylex;
msg_Dbg( vd, "DirectXCreateWindow" );
@@ -1043,9 +1043,9 @@ event_thread_t *EventThreadCreate( vout_display_t *vd)
p_event->source = vd->source;
vout_display_PlacePicture(&p_event->place, &vd->source, vd->cfg, false);
- _snprintf( p_event->class_main, sizeof(p_event->class_main)/sizeof(*p_event->class_main),
+ _sntprintf( p_event->class_main, sizeof(p_event->class_main)/sizeof(*p_event->class_main),
_T("VLC MSW %p"), p_event );
- _snprintf( p_event->class_video, sizeof(p_event->class_video)/sizeof(*p_event->class_video),
+ _sntprintf( p_event->class_video, sizeof(p_event->class_video)/sizeof(*p_event->class_video),
_T("VLC MSW video %p"), p_event );
return p_event;
}
More information about the vlc-commits
mailing list