[vlc-devel] [vlc-commits] DirectDraw: DirectDrawEnumerateExW does not work, use DirectDrawEnumerateExA instead.
Rafaël Carré
funman at videolan.org
Mon Jan 20 16:59:24 CET 2014
Hello,
On 01/20/14 16:44, Felix Abecassis wrote:
> vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Mon Jan 20 16:30:14 2014 +0100| [77c6cbf165d9f460e22674c8738d75d84e8a0fc3] | committer: Jean-Baptiste Kempf
>
> DirectDraw: DirectDrawEnumerateExW does not work, use DirectDrawEnumerateExA instead.
>
> Fix #10189, #10307.
>
> Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=77c6cbf165d9f460e22674c8738d75d84e8a0fc3
> ---
>
> modules/video_output/msw/directx.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
> index cb48b73..603c247 100644
> --- a/modules/video_output/msw/directx.c
> +++ b/modules/video_output/msw/directx.c
> @@ -57,7 +57,7 @@
> #endif
>
> #ifdef UNICODE
> -# define DIRECTDRAWENUMERATEEX_NAME "DirectDrawEnumerateExW"
> +# define DIRECTDRAWENUMERATEEX_NAME "DirectDrawEnumerateExA"
> #else
> # define DIRECTDRAWENUMERATEEX_NAME "DirectDrawEnumerateExA"
> #endif
Please remove the ifdef UNICODE, or even merge it where it's used.
> @@ -453,8 +453,8 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
http://msdn.microsoft.com/en-us/library/windows/desktop/gg426106(v=vs.85).aspx
desc and drivername are LPSTR, not LPTSTR.
You can use LPDDENUMCALLBACKEXA to avoid prototype mismatch
> if (!hmon)
> return TRUE;
>
> - char *psz_drivername = FromT(drivername);
> - char *psz_desc = FromT(desc);
> + char *psz_drivername = (char*)drivername;
> + char *psz_desc = (char*)desc;
If you use the correct prototype, casting char * to char * will not be
needed either.
> msg_Dbg(vd, "DirectXEnumCallback: %s, %s", psz_desc, psz_drivername);
>
> @@ -493,8 +493,6 @@ static BOOL WINAPI DirectXOpenDDrawCallback(GUID *guid, LPTSTR desc,
> *sys->display_driver = *guid;
> }
>
> - free(psz_drivername);
> - free(psz_desc);
> return TRUE;
> }
> /**
> @@ -1420,7 +1418,7 @@ static BOOL WINAPI DirectXEnumCallback2(GUID *guid, LPTSTR desc,
>
> VLC_UNUSED(guid); VLC_UNUSED(desc); VLC_UNUSED(hmon);
>
> - char *psz_drivername = FromT(drivername);
> + char *psz_drivername = (char*)(drivername);
Same remark than above
> ctx->values = xrealloc(ctx->values, (ctx->count + 1) * sizeof(char *));
> ctx->descs = xrealloc(ctx->descs, (ctx->count + 1) * sizeof(char *));
>
> @@ -1428,7 +1426,6 @@ static BOOL WINAPI DirectXEnumCallback2(GUID *guid, LPTSTR desc,
> ctx->descs[ctx->count] = strdup(psz_drivername);
> ctx->count++;
>
> - free(psz_drivername);
> return TRUE; /* Keep enumerating */
> }
More information about the vlc-devel
mailing list