(svn r8239) -Regression (r7278): Help window was empty for UNICODE builds
authorDarkvater
Thu, 18 Jan 2007 14:06:30 +0000
changeset 5722 62abdb0d0662
parent 5721 fa4e587f59f5
child 5723 748cb24d9340
(svn r8239) -Regression (r7278): Help window was empty for UNICODE builds
src/win32.cpp
--- a/src/win32.cpp	Thu Jan 18 09:34:44 2007 +0000
+++ b/src/win32.cpp	Thu Jan 18 14:06:30 2007 +0000
@@ -371,7 +371,7 @@
 		case WM_INITDIALOG: {
 #if defined(UNICODE)
 			/* We need to put the crash-log in a seperate buffer because the default
-			 * buffer in MB_TO_WIDE is not large enough (256 chars) */
+			 * buffer in MB_TO_WIDE is not large enough (512 chars) */
 			wchar_t crash_msgW[8096];
 #endif
 			SetDlgItemText(wnd, 10, _crash_desc);
@@ -841,12 +841,16 @@
 		fprintf(stderr, "%s\n", str);
 	} else {
 		bool old;
-
+#if defined(UNICODE)
+			/* We need to put the text in a seperate buffer because the default
+			 * buffer in MB_TO_WIDE might not be large enough (512 chars) */
+			wchar_t help_msgW[4096];
+#endif
 		ReleaseCapture();
 		_left_button_clicked =_left_button_down = false;
 
 		old = MyShowCursor(true);
-		if (MessageBox(GetActiveWindow(), MB_TO_WIDE(str), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
+		if (MessageBox(GetActiveWindow(), MB_TO_WIDE_BUFFER(str, help_msgW, lengthof(help_msgW)), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
 			CreateConsole();
 		}
 		MyShowCursor(old);