mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
some VS adoptations
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
2775f5a2d4
commit
0155a4bf8a
@ -88,7 +88,12 @@ public:
|
||||
|
||||
|
||||
void vSPrintf(const char* format, VA_LIST va);
|
||||
void SPrintf(const char* format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
#ifndef _MSC_VER
|
||||
void SPrintf(const char* format, ...) __attribute__((__format__(__printf__, 2, 3)));
|
||||
#else
|
||||
void SPrintf(const char* format, ...);
|
||||
#endif // !__MSC_VER
|
||||
|
||||
|
||||
const XStringW &operator =(const XStringW &aString);
|
||||
const XStringW &operator =(const wchar_t* S);
|
||||
@ -117,8 +122,8 @@ public:
|
||||
int Compare(const wchar_t* S) const { return (int)StrCmp(data(), S) ; }
|
||||
|
||||
bool Equal(const wchar_t* S) const { return Compare(S) == 0; };
|
||||
bool BeginingEqual(const wchar_t* S) const { return StrnCmp(data(), S, StrLen(S)); }
|
||||
bool SubStringEqual(UINTN Pos, const wchar_t* S) const { return StrCmp(data(Pos), S); }
|
||||
bool BeginingEqual(const wchar_t* S) const { return (StrnCmp(data(), S, StrLen(S)) == 0); }
|
||||
bool SubStringEqual(UINTN Pos, const wchar_t* S) const { return (StrCmp(data(Pos), S) == 0); }
|
||||
|
||||
XStringW basename() const;
|
||||
XStringW dirname() const;
|
||||
@ -171,8 +176,13 @@ public:
|
||||
};
|
||||
|
||||
//extern const XStringW NullXStringW;
|
||||
#ifndef _MSC_VER
|
||||
XStringW SPrintf(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)));
|
||||
#else
|
||||
XStringW SPrintf(const char* format, ...);
|
||||
#endif // !__MSC_VER
|
||||
|
||||
|
||||
XStringW SPrintf(const char* format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
XStringW SubString(const wchar_t *S, UINTN pos, UINTN count);
|
||||
|
||||
XStringW CleanCtrl(const XStringW &S);
|
||||
|
@ -202,7 +202,7 @@ static void print_string(const unsigned char* s, PrintfParams* printfParams)
|
||||
print_char(c, printfParams);
|
||||
#else
|
||||
if ( c <= 0xFFFF) {
|
||||
print_char(c, printfParams);
|
||||
print_char((wchar_t)c, printfParams);
|
||||
} else {
|
||||
c -= halfBase;
|
||||
print_char((wchar_t)((c >> halfShift) + UNI_SUR_HIGH_START), printfParams);
|
||||
@ -692,8 +692,8 @@ static void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfPa
|
||||
case 'c':
|
||||
#if PRINTF_OUTPUT_FORMAT_UNICODE == 1 && PRINTF_UTF8_SUPPORT == 1
|
||||
if ( printfParams->l_modifier == 0 ) {
|
||||
char c = (char)va_arg(VALIST_ACCESS(valist), int);
|
||||
print_char(c, printfParams); // 'char' is promoted to 'int' when passed through '...'
|
||||
char c1 = (char)va_arg(VALIST_ACCESS(valist), int);
|
||||
print_char((wchar_t)c1, printfParams); // 'char' is promoted to 'int' when passed through '...'
|
||||
printfParams->inDirective = 0;
|
||||
}else
|
||||
#endif
|
||||
|
@ -167,7 +167,7 @@ void utf8ToWChar(wchar_t* dst, size_t dst_max_len, const char *s, size_t src_le
|
||||
if ( dst_len == dst_max_len ) goto exit;
|
||||
#else
|
||||
if ( c <= 0xFFFF) {
|
||||
dst[dst_len++] = c;
|
||||
dst[dst_len++] = (wchar_t)c;
|
||||
if ( dst_len == dst_max_len ) goto exit;
|
||||
} else {
|
||||
c -= halfBase;
|
||||
|
@ -41,7 +41,7 @@ int XStringW_tests()
|
||||
if ( str2 != L"a" ) return 20;
|
||||
str2.SPrintf("%ls", L"ab"); // UTF16(32) string containing ascii char
|
||||
if ( str2 != L"ab" ) return 21;
|
||||
|
||||
#pragma warning(disable : 4066)
|
||||
str2.SPrintf("%lc", L'Ň'); // signe UTF16(32) char. (2 bytes in total if UTF16)
|
||||
if ( str2 != L"Ň" ) return 22;
|
||||
str2.SPrintf("%s", "Ň"); // this is a UTF8 string 2 bytes long
|
||||
|
@ -20,9 +20,15 @@ void* operator new (unsigned long count)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#pragma warning(disable : 4577)
|
||||
void operator delete ( void* ptr ) noexcept
|
||||
{
|
||||
return FreePool(ptr);
|
||||
}
|
||||
|
||||
void __cdecl operator delete(void * ptr, unsigned __int64 count)
|
||||
{
|
||||
return FreePool(ptr);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user