Fixed compilation on non-Windows platforms.
This commit is contained in:
parent
3397d41ba8
commit
de42f649c4
|
@ -44,9 +44,10 @@ namespace cAudio
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(CAUDIO_PLATFORM_WIN) && (defined(UNICODE) || defined(_UNICODE))
|
#if defined(CAUDIO_PLATFORM_WIN)
|
||||||
static const TCHAR* toWINSTR(const char* str)
|
static const TCHAR* toWINSTR(const char* str)
|
||||||
{
|
{
|
||||||
|
#if (defined(UNICODE) || defined(_UNICODE))
|
||||||
static int id = 0;
|
static int id = 0;
|
||||||
static wchar_t buffer[8][1024];
|
static wchar_t buffer[8][1024];
|
||||||
id = ++id & 0x7;
|
id = ++id & 0x7;
|
||||||
|
@ -56,11 +57,26 @@ namespace cAudio
|
||||||
buffer[id][buff_size] = 0;
|
buffer[id][buff_size] = 0;
|
||||||
buffer[id][1023] = 0;
|
buffer[id][1023] = 0;
|
||||||
return buffer[id];
|
return buffer[id];
|
||||||
|
#else
|
||||||
|
return str;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TCHAR* toWINSTR(const wchar_t* str)
|
static const TCHAR* toWINSTR(const wchar_t* str)
|
||||||
{
|
{
|
||||||
|
#if (defined(UNICODE) || defined(_UNICODE))
|
||||||
return str;
|
return str;
|
||||||
|
#else
|
||||||
|
static int id = 0;
|
||||||
|
static char buffer[8][1024];
|
||||||
|
id = ++id & 0x7;
|
||||||
|
|
||||||
|
int slen = wcslen(str);
|
||||||
|
int buff_size = WideCharToMultiByte(CP_UTF8, 0, str, (int)(slen < 1023 ? slen : 1023), buffer[id], 1023, 0, false);
|
||||||
|
buffer[id][buff_size] = 0;
|
||||||
|
buffer[id][1023] = 0;
|
||||||
|
return buffer[id];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* toUTF8(const cAudioString& str)
|
static const char* toUTF8(const cAudioString& str)
|
||||||
|
@ -93,15 +109,7 @@ namespace cAudio
|
||||||
#else
|
#else
|
||||||
static const char* toWINSTR(const char* str)
|
static const char* toWINSTR(const char* str)
|
||||||
{
|
{
|
||||||
static int id = 0;
|
return str;
|
||||||
static char buffer[8][1024];
|
|
||||||
id = ++id & 0x7;
|
|
||||||
|
|
||||||
int slen = wcslen(str);
|
|
||||||
int buff_size = WideCharToMultiByte(CP_UTF8, 0, str, (int)(slen < 1023 ? slen : 1023), buffer[id], 1023, 0, false);
|
|
||||||
buffer[id][buff_size] = 0;
|
|
||||||
buffer[id][1023] = 0;
|
|
||||||
return buffer[id];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* toUTF8(const cAudioString& str)
|
static const char* toUTF8(const cAudioString& str)
|
||||||
|
|
Loading…
Reference in New Issue