summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2018-06-24 20:44:37 +0200
committerMichael Lutz <michi@icosahedron.de>2018-06-27 22:16:43 +0200
commitdbfc417e65804c09cecf6e549de74a18639f6f7b (patch)
tree85426a6581f54a33d0a153db296ff8182575951e /src/video
parent6c02c1993101da6988d56165694ddd89f439dd2e (diff)
downloadopenttd-dbfc417e65804c09cecf6e549de74a18639f6f7b.tar.xz
Fix: [Win32] Garbage in OS window title if branch name was too long.
This was caused by a missing \0-character on reaching the buffer limit.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/win32_v.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index d1d4a4cd5..9559163c3 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -338,13 +338,13 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
if (_wnd.main_wnd != NULL) {
if (!_window_maximize) SetWindowPos(_wnd.main_wnd, 0, 0, 0, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
} else {
- TCHAR Windowtitle[50];
int x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
int y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
- _sntprintf(Windowtitle, lengthof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision));
+ char window_title[64];
+ seprintf(window_title, lastof(window_title), "OpenTTD %s", _openttd_revision);
- _wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0);
+ _wnd.main_wnd = CreateWindow(_T("OTTD"), MB_TO_WIDE(window_title), style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0);
if (_wnd.main_wnd == NULL) usererror("CreateWindow failed");
ShowWindow(_wnd.main_wnd, showstyle);
}