From 0b52ac8a78245793daaf533f5f8b74cb019a8aa8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 28 Jul 2015 23:59:17 +0200 Subject: win32: replace wchar_t with WCHAR WCHAR is more portable. While at least MinGW, Cygwin, and MSVC actually use 16 bit wchar_t, Midipix will have 32 bit wchar_t. In that context, using WCHAR instead is more portable. This affects only non-MinGW parts, so not all uses of wchar_t need to be changed. For example, terminal-win.c won't be used on Midipix at all. (Most of io.c won't either, so the search & replace here is more than necessary, but also not harmful.) (Midipix is not useable yet, so this is just preparation.) --- video/out/w32_common.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'video/out/w32_common.c') diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 5197ad054c..e9b01d5401 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -42,7 +42,7 @@ #include "misc/rendezvous.h" #include "talloc.h" -static const wchar_t classname[] = L"mpv"; +static const WCHAR classname[] = L"mpv"; static __thread struct vo_w32_state *w32_thread_context; @@ -237,7 +237,7 @@ static HRESULT STDMETHODCALLTYPE DropTarget_Drop(IDropTarget* This, UINT nrecvd_files = 0; for (UINT i = 0; i < numFiles; i++) { UINT len = DragQueryFileW(hDrop, i, NULL, 0); - wchar_t* buf = talloc_array(NULL, wchar_t, len + 1); + WCHAR* buf = talloc_array(NULL, WCHAR, len + 1); if (DragQueryFileW(hDrop, i, buf, len + 1) == len) { char* fname = mp_to_utf8(files, buf); @@ -400,12 +400,12 @@ static int mod_state(struct vo_w32_state *w32) return res; } -static int decode_surrogate_pair(wchar_t lead, wchar_t trail) +static int decode_surrogate_pair(WCHAR lead, WCHAR trail) { return 0x10000 + (((lead & 0x3ff) << 10) | (trail & 0x3ff)); } -static int decode_utf16(struct vo_w32_state *w32, wchar_t c) +static int decode_utf16(struct vo_w32_state *w32, WCHAR c) { // Decode UTF-16, keeping state in w32->high_surrogate if (IS_HIGH_SURROGATE(c)) { @@ -435,7 +435,7 @@ static void clear_keyboard_buffer(void) static const UINT vkey = VK_DECIMAL; static const BYTE keys[256] = { 0 }; UINT scancode = MapVirtualKey(vkey, MAPVK_VK_TO_VSC); - wchar_t buf[10]; + WCHAR buf[10]; int ret = 0; // Use the method suggested by Michael Kaplan to clear any pending dead @@ -453,7 +453,7 @@ static int to_unicode(UINT vkey, UINT scancode, const BYTE keys[256]) // Make the buffer 10 code units long to be safe, same as here: // https://web.archive.org/web/20101013215215/http://blogs.msdn.com/b/michkap/archive/2006/03/24/559169.aspx - wchar_t buf[10] = { 0 }; + WCHAR buf[10] = { 0 }; // Dead keys aren't useful for key shortcuts, so clear the keyboard state clear_keyboard_buffer(); @@ -541,7 +541,7 @@ static void handle_key_up(struct vo_w32_state *w32, UINT vkey, UINT scancode) } } -static bool handle_char(struct vo_w32_state *w32, wchar_t wc) +static bool handle_char(struct vo_w32_state *w32, WCHAR wc) { int c = decode_utf16(w32, wc); @@ -1325,7 +1325,7 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg) SetThreadExecutionState(ES_CONTINUOUS); return VO_TRUE; case VOCTRL_UPDATE_WINDOW_TITLE: { - wchar_t *title = mp_from_utf8(NULL, (char *)arg); + WCHAR *title = mp_from_utf8(NULL, (char *)arg); SetWindowTextW(w32->window, title); talloc_free(title); return VO_TRUE; -- cgit v1.2.3