mirror of https://github.com/OpenTTD/OpenTTD
(svn r8624) [0.5] -Backport from trunk (8239, 8240, 8315):
-Regression (r7278): Help window was empty for UNICODE builds -Fix (r8013): Put the output of -h to stdout and not to stderr (through ShowInfo) -Fix: use ShowInfo over fprintf(stderr, as Windows doesn't always have a stderr visible/availablerelease/0.5
parent
03bfa6e525
commit
1584e061eb
|
@ -145,7 +145,7 @@ static bool FileMD5(const MD5File file, bool warn)
|
||||||
while ((len = fread(buffer, 1, sizeof(buffer), f)) != 0)
|
while ((len = fread(buffer, 1, sizeof(buffer), f)) != 0)
|
||||||
md5_append(&filemd5state, buffer, len);
|
md5_append(&filemd5state, buffer, len);
|
||||||
|
|
||||||
if (ferror(f) && warn) fprintf(stderr, "Error Reading from %s \n", buf);
|
if (ferror(f) && warn) ShowInfoF("Error Reading from %s \n", buf);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
md5_finish(&filemd5state, digest);
|
md5_finish(&filemd5state, digest);
|
||||||
|
|
|
@ -163,7 +163,13 @@ static void showhelp(void)
|
||||||
|
|
||||||
p = GetDriverList(p, lastof(buf));
|
p = GetDriverList(p, lastof(buf));
|
||||||
|
|
||||||
|
/* ShowInfo put output to stderr, but version information should go
|
||||||
|
* to stdout; this is the only exception */
|
||||||
|
#if !defined(WIN32) && !defined(WIN64)
|
||||||
|
printf("%s\n", buf);
|
||||||
|
#else
|
||||||
ShowInfo(buf);
|
ShowInfo(buf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
10
win32.c
10
win32.c
|
@ -369,7 +369,7 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd,UINT msg,WPARAM wParam,LPARAM l
|
||||||
case WM_INITDIALOG: {
|
case WM_INITDIALOG: {
|
||||||
#if defined(UNICODE)
|
#if defined(UNICODE)
|
||||||
/* We need to put the crash-log in a seperate buffer because the default
|
/* 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];
|
wchar_t crash_msgW[8096];
|
||||||
#endif
|
#endif
|
||||||
SetDlgItemText(wnd, 10, _crash_desc);
|
SetDlgItemText(wnd, 10, _crash_desc);
|
||||||
|
@ -839,12 +839,16 @@ void ShowInfo(const char *str)
|
||||||
fprintf(stderr, "%s\n", str);
|
fprintf(stderr, "%s\n", str);
|
||||||
} else {
|
} else {
|
||||||
bool old;
|
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();
|
ReleaseCapture();
|
||||||
_left_button_clicked =_left_button_down = false;
|
_left_button_clicked =_left_button_down = false;
|
||||||
|
|
||||||
old = MyShowCursor(true);
|
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();
|
CreateConsole();
|
||||||
}
|
}
|
||||||
MyShowCursor(old);
|
MyShowCursor(old);
|
||||||
|
|
Loading…
Reference in New Issue