--- hatari/src/includes/str.h 2019/04/09 08:54:29 1.1.1.6 +++ hatari/src/includes/str.h 2019/04/09 08:55:42 1.1.1.7 @@ -8,12 +8,27 @@ #ifndef HATARI_STR_H #define HATARI_STR_H +#include "config.h" #include -#include #if HAVE_STRINGS_H # include #endif +#if !HAVE_LIBC_STRLCPY +#define strlcpy(dst, src, len) SDL_strlcpy(dst, src, len) +#endif + +/* Define this only for an old Linux system which does not store + * pathnames in UTF-8. If this is defined, pathnames are converted + * to the host character set as defined by the locale. + * Do not define this for OSX, as the unicode pathnames then won't + * be converted from the decomposed to the precomposed form. + * + * TODO: this should have option / be set in CMake config. + */ +/* #define USE_LOCALE_CHARSET 1 */ + + /* Invalid characters in paths & filenames are replaced by this, * a valid, but uncommon GEMDOS file name character, * which hopefully shouldn't cause problems in: @@ -31,4 +46,9 @@ extern bool Str_IsHex(const char *str); extern void Str_Filename2TOSname(const char *src, char *dst); extern void Str_Dump_Hex_Ascii ( char *p , int Len , int Width , const char *Suffix , FILE *pFile ); +/* Interface of character set conversions */ +extern void Str_AtariToHost(const char *source, char *dest, int destLen, char replacementChar); +extern void Str_DecomposedToPrecomposedUtf8(const char *source, char *dest); + + #endif /* HATARI_STR_H */