Merge branch 'master' of https://github.com/hyzboy/CMCore
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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)<dst_size))
|
||||
while(*sp&&(int(tp-dst)<dst_size))
|
||||
{
|
||||
if(*sp<=0x7F) // U-00000000 - U-0000007F: 0xxx
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace hgl
|
||||
|
||||
// *tp=0;
|
||||
|
||||
return int(tp-(uint8 *)dst);
|
||||
return int(tp-dst);
|
||||
}
|
||||
|
||||
int u8_to_u16(u16char *dst,int dst_size,const u8char *src,const int src_size)
|
||||
@@ -63,7 +63,7 @@ namespace hgl
|
||||
if(!dst||dst_size<=0)
|
||||
return(-1);
|
||||
|
||||
const uint8 *sp=(uint8 *)src;
|
||||
const u8char *sp=src;
|
||||
u16char *tp=dst;
|
||||
|
||||
while(*sp&&(int(tp-dst)<dst_size))
|
||||
@@ -174,11 +174,11 @@ namespace hgl
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
uint8 *sp=(uint8 *)src;
|
||||
const u8char *sp=src;
|
||||
|
||||
dst_size=0;
|
||||
|
||||
while(*sp&&(sp-(uint8 *)src)<src_size)
|
||||
while(*sp&&(sp-src)<src_size)
|
||||
{
|
||||
if(*sp<0x80) // U-00000000 - U-0000007F: 0xxxxxxx
|
||||
{
|
||||
|
Reference in New Issue
Block a user