diff --git a/inc/hgl/platform/compiler/Microsoft.h b/inc/hgl/platform/compiler/Microsoft.h index 9bf7dc0..01150d8 100644 --- a/inc/hgl/platform/compiler/Microsoft.h +++ b/inc/hgl/platform/compiler/Microsoft.h @@ -18,6 +18,12 @@ #define HGL_THREAD_LOCAL_STORAGE __declspec(thread) //线程本地储存 //-------------------------------------------------------------------------------------------------- +#if _MSVC_LANG>=201704L //C++20 +using u8char =char8_t; +#else +using u8char =char; +#endif + #define HGL_FMT_I64 "%I64d" #define HGL_FMT_U64 "%I64u" //参考文档最后查阅支持版本为VC2013,网址:http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx diff --git a/inc/hgl/platform/os/CharType.h b/inc/hgl/platform/os/CharType.h index d35345b..bf4bdae 100644 --- a/inc/hgl/platform/os/CharType.h +++ b/inc/hgl/platform/os/CharType.h @@ -10,6 +10,7 @@ using os_char =char; #define OS_TEXT(str) u8##str #define U8_TEXT(str) u8##str #define U16_TEXT(str) u##str +#define U32_TEXT(str) U##str #define os_main main #define os_out std::cout diff --git a/inc/hgl/platform/os/MSWindows.h b/inc/hgl/platform/os/MSWindows.h index 506fc42..5155a4e 100644 --- a/inc/hgl/platform/os/MSWindows.h +++ b/inc/hgl/platform/os/MSWindows.h @@ -11,13 +11,13 @@ //-------------------------------------------------------------------------------------------------- using u32char =char32_t; using u16char =wchar_t; -using u8char =char8_t; using os_char =wchar_t; #define to_oschar to_u16 #define OS_TEXT(str) L##str #define U8_TEXT(str) u8##str #define U16_TEXT(str) L##str +#define U32_TEXT(str) U##str #define os_main wmain #define os_out std::wcout diff --git a/src/Other/CodePage.cpp b/src/Other/CodePage.cpp index b8d9426..16425a0 100644 --- a/src/Other/CodePage.cpp +++ b/src/Other/CodePage.cpp @@ -22,9 +22,9 @@ namespace hgl return(-1); const u16char *sp=src; - uint8 *tp=(uint8 *)dst; + u8char *tp=dst; - while(*sp&&(int(tp-(uint8 *)dst)