forked from mirror/OpenTTD
(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
This commit is contained in:
15
win32.h
15
win32.h
@@ -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 */
|
||||
|
Reference in New Issue
Block a user