12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
* GNU General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU Lesser General Public License |
|
|
* along with GPGOE; if not, write to the Free Software Foundation, |
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
15 |
*/ |
*/ |
16 |
|
|
17 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
42 |
|
|
43 |
n = MultiByteToWideChar (GetACP (), 0, string, -1, result, n); |
n = MultiByteToWideChar (GetACP (), 0, string, -1, result, n); |
44 |
if (n < 0) { |
if (n < 0) { |
45 |
free (result); |
xfree (result); |
46 |
return NULL; |
return NULL; |
47 |
} |
} |
48 |
|
|
54 |
|
|
55 |
n = WideCharToMultiByte (CP_UTF8, 0, result, -1, native, n, NULL, NULL); |
n = WideCharToMultiByte (CP_UTF8, 0, result, -1, native, n, NULL, NULL); |
56 |
if (n < 0) { |
if (n < 0) { |
57 |
free (result); |
xfree (result); |
58 |
return NULL; |
return NULL; |
59 |
} |
} |
60 |
|
|
61 |
free (result); |
xfree (result); |
62 |
return native; |
return native; |
63 |
} |
} |
64 |
|
|
74 |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, NULL, 0); |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, NULL, 0); |
75 |
if (n < 0) |
if (n < 0) |
76 |
return NULL; |
return NULL; |
|
|
|
77 |
result = (wchar_t*)xcalloc (1, (n+1) * sizeof *result); |
result = (wchar_t*)xcalloc (1, (n+1) * sizeof *result); |
|
|
|
78 |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, result, n); |
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, result, n); |
79 |
if (n < 0) { |
if (n < 0) { |
80 |
free (result); |
xfree (result); |
81 |
return NULL; |
return NULL; |
82 |
} |
} |
83 |
|
|
84 |
n = WideCharToMultiByte (GetACP (), 0, result, -1, NULL, 0, NULL, NULL); |
n = WideCharToMultiByte (GetACP (), 0, result, -1, NULL, 0, NULL, NULL); |
85 |
if (n < 0) |
if (n < 0) |
86 |
return NULL; |
return NULL; |
87 |
|
native = (char*)xcalloc (1, n+1); |
|
native = (char*)malloc (n+1); |
|
|
if (!native) |
|
|
abort (); |
|
|
|
|
88 |
n = WideCharToMultiByte (GetACP (), 0, result, -1, native, n, NULL, NULL); |
n = WideCharToMultiByte (GetACP (), 0, result, -1, native, n, NULL, NULL); |
89 |
if (n < 0) { |
if (n < 0) { |
90 |
free (result); |
xfree (result); |
91 |
return NULL; |
return NULL; |
92 |
} |
} |
93 |
|
|
94 |
free (result); |
xfree (result); |
95 |
return native; |
return native; |
96 |
} |
} |
97 |
|
|
200 |
va_list ptr; |
va_list ptr; |
201 |
|
|
202 |
va_start (ptr, fmt); |
va_start (ptr, fmt); |
203 |
_vsnprintf (buffer, sizeof (buffer)-1, fmt, ptr); |
_vsnprintf (buffer, DIM (buffer)-1, fmt, ptr); |
204 |
va_end (ptr); |
va_end (ptr); |
205 |
MessageBox (hwnd, buffer, caption, type); |
MessageBox (hwnd, buffer, caption, type); |
206 |
} |
} |
236 |
/* Center the window @hwndChild over the parent window @parent. */ |
/* Center the window @hwndChild over the parent window @parent. */ |
237 |
void |
void |
238 |
center_window (HWND hwndChild, HWND parent) |
center_window (HWND hwndChild, HWND parent) |
239 |
{ |
{ |
240 |
HWND hwndParent; |
HWND hwndParent; |
241 |
RECT rChild, rParent; |
RECT rChild, rParent; |
242 |
HDC hdc; |
HDC hdc; |