46 |
|
|
47 |
n = MultiByteToWideChar (GetACP (), 0, string, -1, result, n); |
n = MultiByteToWideChar (GetACP (), 0, string, -1, result, n); |
48 |
if (n < 0) { |
if (n < 0) { |
49 |
free (result); |
xfree (result); |
50 |
return NULL; |
return NULL; |
51 |
} |
} |
52 |
|
|
58 |
|
|
59 |
n = WideCharToMultiByte (CP_UTF8, 0, result, -1, native, n, NULL, NULL); |
n = WideCharToMultiByte (CP_UTF8, 0, result, -1, native, n, NULL, NULL); |
60 |
if (n < 0) { |
if (n < 0) { |
61 |
free (result); |
xfree (result); |
62 |
return NULL; |
return NULL; |
63 |
} |
} |
64 |
|
|
65 |
free (result); |
xfree (result); |
66 |
return native; |
return native; |
67 |
} |
} |
68 |
|
|
78 |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, NULL, 0); |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, NULL, 0); |
79 |
if (n < 0) |
if (n < 0) |
80 |
return NULL; |
return NULL; |
|
|
|
81 |
result = (wchar_t*)xcalloc (1, (n+1) * sizeof *result); |
result = (wchar_t*)xcalloc (1, (n+1) * sizeof *result); |
|
|
|
82 |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, result, n); |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, result, n); |
83 |
if (n < 0) { |
if (n < 0) { |
84 |
free (result); |
xfree (result); |
85 |
return NULL; |
return NULL; |
86 |
} |
} |
87 |
|
|
88 |
n = WideCharToMultiByte (GetACP (), 0, result, -1, NULL, 0, NULL, NULL); |
n = WideCharToMultiByte (GetACP (), 0, result, -1, NULL, 0, NULL, NULL); |
89 |
if (n < 0) |
if (n < 0) |
90 |
return NULL; |
return NULL; |
91 |
|
native = (char*)xcalloc (1, n+1); |
|
native = (char*)malloc (n+1); |
|
|
if (!native) |
|
|
abort (); |
|
|
|
|
92 |
n = WideCharToMultiByte (GetACP (), 0, result, -1, native, n, NULL, NULL); |
n = WideCharToMultiByte (GetACP (), 0, result, -1, native, n, NULL, NULL); |
93 |
if (n < 0) { |
if (n < 0) { |
94 |
free (result); |
xfree (result); |
95 |
return NULL; |
return NULL; |
96 |
} |
} |
97 |
|
|
98 |
free (result); |
xfree (result); |
99 |
return native; |
return native; |
100 |
} |
} |
101 |
|
|
204 |
va_list ptr; |
va_list ptr; |
205 |
|
|
206 |
va_start (ptr, fmt); |
va_start (ptr, fmt); |
207 |
_vsnprintf (buffer, sizeof (buffer)-1, fmt, ptr); |
_vsnprintf (buffer, DIM (buffer)-1, fmt, ptr); |
208 |
va_end (ptr); |
va_end (ptr); |
209 |
MessageBox (hwnd, buffer, caption, type); |
MessageBox (hwnd, buffer, caption, type); |
210 |
} |
} |
240 |
/* Center the window @hwndChild over the parent window @parent. */ |
/* Center the window @hwndChild over the parent window @parent. */ |
241 |
void |
void |
242 |
center_window (HWND hwndChild, HWND parent) |
center_window (HWND hwndChild, HWND parent) |
243 |
{ |
{ |
244 |
HWND hwndParent; |
HWND hwndParent; |
245 |
RECT rChild, rParent; |
RECT rChild, rParent; |
246 |
HDC hdc; |
HDC hdc; |