diff options
author | Darkvater <darkvater@openttd.org> | 2006-12-03 17:47:53 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-12-03 17:47:53 +0000 |
commit | b789cacb405cb25b4bf1d7c563a51370a333db23 (patch) | |
tree | 369238bf31629ca32a4d9c0963f419ff2fda78f8 /win32.h | |
parent | 5fffa66b71c395da722ff109b5bb37f9ca35d963 (diff) | |
download | openttd-b789cacb405cb25b4bf1d7c563a51370a333db23.tar.xz |
(svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
into a predefined buffer insted of using the static (global) buffer. This is useful if
the converted value will be used later on; no need to copy it somewhere else to save it.
-CodeChange: [win32] Added appropiate macros WIDE_TO_MB_BUFFER, MB_TO_WIDE_BUFFER next to
existing WIDE_TO_MB and MB_TO_WIDE that only do work when UNICODE is defined, saves
#ifdefs all over the place
Diffstat (limited to 'win32.h')
-rw-r--r-- | win32.h | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -8,12 +8,19 @@ bool MyShowCursor(bool show); typedef void (*Function)(int); bool LoadLibraryList(Function proc[], const char *dll); +char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen); +wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen); + #if defined(UNICODE) -# define MB_TO_WIDE(x) OTTD2FS(x) -# define WIDE_TO_MB(x) FS2OTTD(x) +# define MB_TO_WIDE(str) OTTD2FS(str) +# define MB_TO_WIDE_BUFFER(str, buffer, buflen) convert_to_fs(str, buffer, buflen) +# define WIDE_TO_MB(str) FS2OTTD(str) +# define WIDE_TO_MB_BUFFER(str, buffer, buflen) convert_from_fs(str, buffer, buflen) #else -# define MB_TO_WIDE(x) (x) -# define WIDE_TO_MB(x) (x) +# define MB_TO_WIDE(str) (str) +# define MB_TO_WIDE_BUFFER(str, buffer, buflen) (str) +# define WIDE_TO_MB(str) (str) +# define WIDE_TO_MB_BUFFER(str, buffer, buflen) (str) #endif #endif /* WIN32_H */ |