From 5ebf72d1260fbe38e1a3ee118ac4b692041c9885 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 26 Apr 2014 07:30:15 +0000 Subject: (svn r26517) -Fix: Windows 9x (or rather non-unicode) compile failures --- src/ini.cpp | 2 ++ src/os/windows/crashlog_win.cpp | 4 ++++ src/os/windows/win32.cpp | 3 +++ 3 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/ini.cpp b/src/ini.cpp index 2e4e9097f..ccce19239 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -89,6 +89,8 @@ bool IniFile::SaveToDisk(const char *filename) #endif #if defined(WIN32) || defined(WIN64) + /* _tcsncpy = strcpy is TCHAR is char, but isn't when TCHAR is wchar. */ + #undef strncpy /* Allocate space for one more \0 character. */ TCHAR tfilename[MAX_PATH + 1], tfile_new[MAX_PATH + 1]; _tcsncpy(tfilename, OTTD2FS(filename), MAX_PATH); diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 9704403c8..39f100601 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -613,6 +613,10 @@ static void SetWndSize(HWND wnd, int mode) } } +/* When TCHAR is char, then _sntprintf becomes snprintf. When TCHAR is wchar it doesn't. Likewise for strcat. */ +#undef snprintf +#undef strcat + static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index bac1416e4..0867adb99 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -29,7 +29,10 @@ #include #include +/* Due to TCHAR, strncat and strncpy have to remain (for a while). */ #include "../../safeguards.h" +#undef strncat +#undef strncpy static bool _has_console; static bool _cursor_disable = true; -- cgit v1.2.3-54-g00ecf