|
|
@ -1298,12 +1298,12 @@ static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, in |
|
|
|
|
|
|
|
|
|
|
|
#ifndef STBI_NO_STDIO |
|
|
|
#ifndef STBI_NO_STDIO |
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) |
|
|
|
#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) |
|
|
|
STBI_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); |
|
|
|
STBI_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); |
|
|
|
STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); |
|
|
|
STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) |
|
|
|
#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) |
|
|
|
STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) |
|
|
|
STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); |
|
|
|
return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); |
|
|
@ -1313,7 +1313,7 @@ STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wch |
|
|
|
static FILE *stbi__fopen(char const *filename, char const *mode) |
|
|
|
static FILE *stbi__fopen(char const *filename, char const *mode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FILE *f; |
|
|
|
FILE *f; |
|
|
|
#if defined(_MSC_VER) && defined(STBI_WINDOWS_UTF8) |
|
|
|
#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) |
|
|
|
wchar_t wMode[64]; |
|
|
|
wchar_t wMode[64]; |
|
|
|
wchar_t wFilename[1024]; |
|
|
|
wchar_t wFilename[1024]; |
|
|
|
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename))) |
|
|
|
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename))) |
|
|
@ -1322,7 +1322,7 @@ static FILE *stbi__fopen(char const *filename, char const *mode) |
|
|
|
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode))) |
|
|
|
if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode))) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
#if _MSC_VER >= 1400 |
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1400 |
|
|
|
if (0 != _wfopen_s(&f, wFilename, wMode)) |
|
|
|
if (0 != _wfopen_s(&f, wFilename, wMode)) |
|
|
|
f = 0; |
|
|
|
f = 0; |
|
|
|
#else |
|
|
|
#else |
|
|
|