Changeset - r22933:51ae695fcd0f
[Not reviewed]
master
0 1 0
Michael Lutz - 6 years ago 2018-06-24 18:44:37
michi@icosahedron.de
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.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/video/win32_v.cpp
Show inline comments
 
@@ -335,19 +335,19 @@ bool VideoDriver_Win32::MakeWindow(bool 
 
		w = r.right - r.left;
 
		h = r.bottom - r.top;
 

	
 
		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);
 
		}
 
	}
 

	
 
	BlitterFactory::GetCurrentBlitter()->PostResize();
0 comments (0 inline, 0 general)