From b0ac44632202b2f2ef6921b669c7ed4c48d3ee4a Mon Sep 17 00:00:00 2001 From: hyzboy Date: Wed, 8 Jul 2020 10:16:24 +0800 Subject: [PATCH] move u8char position --- inc/hgl/platform/compiler/Microsoft.h | 6 ++++++ inc/hgl/platform/os/MSWindows.h | 1 - src/Other/CodePage.cpp | 12 ++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) 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/MSWindows.h b/inc/hgl/platform/os/MSWindows.h index 506fc42..a68bce8 100644 --- a/inc/hgl/platform/os/MSWindows.h +++ b/inc/hgl/platform/os/MSWindows.h @@ -11,7 +11,6 @@ //-------------------------------------------------------------------------------------------------- using u32char =char32_t; using u16char =wchar_t; -using u8char =char8_t; using os_char =wchar_t; #define to_oschar to_u16 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)