mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
Fix %x format for char and short.
This commit is contained in:
parent
e1345d7ba0
commit
647955dd8c
@ -103,6 +103,12 @@ extern "C"
|
||||
#ifndef PRINTF_LITE_LONGINT_SUPPORT
|
||||
#define PRINTF_LITE_LONGINT_SUPPORT 1 // 1712 bytes
|
||||
#endif
|
||||
#ifndef PRINTF_LITE_SHORTINT_SUPPORT
|
||||
#define PRINTF_LITE_SHORTINT_SUPPORT 1
|
||||
#endif
|
||||
#ifndef PRINTF_LITE_SHORTSHORTINT_SUPPORT
|
||||
#define PRINTF_LITE_SHORTSHORTINT_SUPPORT 1
|
||||
#endif
|
||||
#ifndef PRINTF_LITE_TIMESTAMP_SUPPORT
|
||||
#define PRINTF_LITE_TIMESTAMP_SUPPORT 0 // 240 bytes
|
||||
#endif
|
||||
|
@ -39,7 +39,7 @@ static void print_timestamp(PrintfParams* printfParams);
|
||||
#elif PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
#define print_char_macro(c, printfParams) print_wchar(c, printfParams);
|
||||
#elif PRINTF_UTF8_OUTPUT_SUPPORT == 1
|
||||
#define print_char_macro(c, printfParams) print_char(c, printfParams);
|
||||
#define print_char_macro(c, printfParams) print_utf8_char(c, printfParams);
|
||||
#endif
|
||||
|
||||
typedef struct PrintfParams PrintfParams;
|
||||
@ -104,7 +104,7 @@ typedef struct PrintfParams {
|
||||
#if PRINTF_UTF8_OUTPUT_SUPPORT == 1
|
||||
// Print a char as is. No analyse is made to check if it's a utf8 partial char
|
||||
// c is an int for prototype compatibility, but must be < 255
|
||||
static void print_char(int c, PrintfParams* printfParams)
|
||||
static void print_utf8_char(int c, PrintfParams* printfParams)
|
||||
{
|
||||
#if PRINTF_LITE_TIMESTAMP_SUPPORT == 1
|
||||
if ( printfParams->newlinePtr )
|
||||
@ -115,7 +115,7 @@ static void print_char(int c, PrintfParams* printfParams)
|
||||
if ( printfParams->timestamp ) print_timestamp(printfParams);
|
||||
}
|
||||
#if PRINTF_EMIT_CR == 1
|
||||
if ( c == '\n' ) print_char('\r', printfParams);
|
||||
if ( c == '\n' ) print_utf8_char('\r', printfParams);
|
||||
#endif
|
||||
#if PRINTF_LITE_BUF_SIZE > 1
|
||||
printfParams->buf.buf[(printfParams->bufIdx)++] = (char)c;
|
||||
@ -125,7 +125,7 @@ static void print_char(int c, PrintfParams* printfParams)
|
||||
if ( c == '\n' ) *printfParams->newlinePtr = 1;
|
||||
}else{
|
||||
#if PRINTF_EMIT_CR == 1
|
||||
if ( c == '\n' ) print_char('\r', printfParams);
|
||||
if ( c == '\n' ) print_utf8_char('\r', printfParams);
|
||||
#endif
|
||||
#if PRINTF_LITE_BUF_SIZE > 1
|
||||
printfParams->buf.buf[(printfParams->bufIdx)++] = (char)c;
|
||||
@ -136,7 +136,7 @@ static void print_char(int c, PrintfParams* printfParams)
|
||||
#else
|
||||
{
|
||||
#if PRINTF_EMIT_CR == 1
|
||||
if ( c == '\n' ) print_char('\r', printfParams);
|
||||
if ( c == '\n' ) print_utf8_char('\r', printfParams);
|
||||
#endif
|
||||
#if PRINTF_LITE_BUF_SIZE > 1
|
||||
printfParams->buf.buf[(printfParams->bufIdx)++] = (char)c;
|
||||
@ -238,29 +238,29 @@ static inline char32_t printf_surrogate_to_utf32(char16_t high, char16_t low) {
|
||||
* Print char32_t to utf8 string.
|
||||
* Only needed if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 1
|
||||
*/
|
||||
static void print_char32(const char32_t utf32_char, PrintfParams* printfParams)
|
||||
static void print_char32_as_utf8_string(const char32_t utf32_char, PrintfParams* printfParams)
|
||||
{
|
||||
/* assertion: utf32_char is a single UTF-4 value */
|
||||
int bits;
|
||||
|
||||
if (utf32_char < 0x80) {
|
||||
print_char((char)utf32_char, printfParams);
|
||||
print_utf8_char((char)utf32_char, printfParams);
|
||||
bits = -6;
|
||||
}
|
||||
else if (utf32_char < 0x800) {
|
||||
print_char((char)(((utf32_char >> 6) & 0x1F) | 0xC0), printfParams);
|
||||
print_utf8_char((char)(((utf32_char >> 6) & 0x1F) | 0xC0), printfParams);
|
||||
bits = 0;
|
||||
}
|
||||
else if (utf32_char < 0x10000) {
|
||||
print_char((char)(((utf32_char >> 12) & 0x0F) | 0xE0), printfParams);
|
||||
print_utf8_char((char)(((utf32_char >> 12) & 0x0F) | 0xE0), printfParams);
|
||||
bits = 6;
|
||||
}
|
||||
else {
|
||||
print_char((char)(((utf32_char >> 18) & 0x07) | 0xF0), printfParams);
|
||||
print_utf8_char((char)(((utf32_char >> 18) & 0x07) | 0xF0), printfParams);
|
||||
bits = 12;
|
||||
}
|
||||
for (; bits >= 0; bits -= 6) {
|
||||
print_char((char)(((utf32_char >> bits) & 0x3F) | 0x80), printfParams);
|
||||
print_utf8_char((char)(((utf32_char >> bits) & 0x3F) | 0x80), printfParams);
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,16 +277,16 @@ static void output_wchar_string_as_utf8(const wchar_t* s, PrintfParams* printfPa
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
const char16_t uc = *s++;
|
||||
if (!printf_is_surrogate(uc)) {
|
||||
print_char32((char32_t)uc, printfParams);
|
||||
print_char32_as_utf8_string((char32_t)uc, printfParams);
|
||||
} else {
|
||||
if (printf_is_high_surrogate(uc) && *s && printf_is_low_surrogate(*s)) {
|
||||
print_char32(printf_surrogate_to_utf32(uc, *s++), printfParams);
|
||||
print_char32_as_utf8_string(printf_surrogate_to_utf32(uc, *s++), printfParams);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#else
|
||||
print_char32((char32_t)(*s++), printfParams);
|
||||
print_char32_as_utf8_string((char32_t)(*s++), printfParams);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -402,11 +402,11 @@ __attribute__((noinline, section(".output_utf8_string")))
|
||||
#elif DEFINE_SECTIONS == 2
|
||||
__attribute__((noinline, section(".printf_lite")))
|
||||
#endif
|
||||
static void output_utf8_string(const char* s, PrintfParams* printfParams)
|
||||
static void output_utf8_string_as_utf8(const char* s, PrintfParams* printfParams)
|
||||
{
|
||||
if ( !s ) return;
|
||||
if ( printfParams->width_specifier ) while ( *s && printfParams->width_specifier-- ) print_char(*s++, printfParams);
|
||||
else while ( *s ) print_char(*s++, printfParams);
|
||||
if ( printfParams->width_specifier ) while ( *s && printfParams->width_specifier-- ) print_utf8_char(*s++, printfParams);
|
||||
else while ( *s ) print_utf8_char(*s++, printfParams);
|
||||
}
|
||||
|
||||
#if DEFINE_SECTIONS == 1
|
||||
@ -659,7 +659,7 @@ static void print_double(double number, PrintfParams* printfParams)
|
||||
#if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_OUTPUT_SUPPORT == 0
|
||||
output_utf8_string(L"<large double>", printfParams);
|
||||
#else
|
||||
output_utf8_string("<large double>", printfParams);
|
||||
output_utf8_string_as_utf8("<large double>", printfParams);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -810,7 +810,7 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
#if PRINTF_LITE_ZSPECIFIER_SUPPORT == 1
|
||||
printfParams->z_modifier = 1;
|
||||
#else
|
||||
printfParams->l_modifier = 2;
|
||||
printfParams->l_modifier = 12;
|
||||
#endif
|
||||
break;
|
||||
#endif // PRINTF_LITE_FALLBACK_FOR_UNSUPPORTED == 1 || PRINTF_LITE_ZSPECIFIER_SUPPORT == 1
|
||||
@ -821,16 +821,29 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
#if PRINTF_LITE_XSPECIFIER_SUPPORT == 1
|
||||
printfParams->uppercase = c == 'X';
|
||||
#if PRINTF_LITE_ZSPECIFIER_SUPPORT == 1
|
||||
if ( printfParams->z_modifier ) print_ulonglong(va_arg(VALIST_ACCESS(valist), size_t), 16, printfParams, 0);
|
||||
else
|
||||
if ( printfParams->z_modifier ) {
|
||||
print_ulonglong(va_arg(VALIST_ACCESS(valist), size_t), 16, printfParams, 0);
|
||||
}else
|
||||
#endif
|
||||
#if PRINTF_LITE_LONGLONGINT_SUPPORT == 1 && PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier == 2 ) print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long long int), 16, printfParams, 0);
|
||||
else
|
||||
if ( printfParams->l_modifier > 11 ) {
|
||||
print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long long int), 16, printfParams, 0);
|
||||
}else
|
||||
#endif
|
||||
#if PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier != 0 ) print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long int), 16, printfParams, 0);
|
||||
else
|
||||
if ( printfParams->l_modifier == 11 ) {
|
||||
print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long int), 16, printfParams, 0);
|
||||
}else
|
||||
#endif
|
||||
#if PRINTF_LITE_SHORTINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier == 9 ) {
|
||||
print_ulonglong((unsigned short)va_arg(VALIST_ACCESS(valist), unsigned int), 16, printfParams, 0); // we are using longlong version for every int to save code size.
|
||||
}else
|
||||
#endif
|
||||
#if PRINTF_LITE_SHORTSHORTINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier < 9 ) {
|
||||
print_ulonglong((unsigned char)va_arg(VALIST_ACCESS(valist), unsigned int), 16, printfParams, 0); // we are using longlong version for every int to save code size.
|
||||
}else
|
||||
#endif
|
||||
print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned int), 16, printfParams, 0);
|
||||
printfParams->inDirective = 0;
|
||||
@ -846,13 +859,23 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
else
|
||||
#endif
|
||||
#if PRINTF_LITE_LONGLONGINT_SUPPORT == 1 && PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier == 2 ) print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long long int), 10, printfParams, 0);
|
||||
if ( printfParams->l_modifier > 11 ) print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long long int), 10, printfParams, 0);
|
||||
else
|
||||
#endif // PRINTF_LITE_LONGLONGINT_SUPPORT == 1 && PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
#if PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier != 0 ) print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long int), 10, printfParams, 0);
|
||||
if ( printfParams->l_modifier == 11 ) print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned long int), 10, printfParams, 0);
|
||||
else
|
||||
#endif // PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
#if PRINTF_LITE_SHORTINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier == 9 ) {
|
||||
print_ulonglong((unsigned short)va_arg(VALIST_ACCESS(valist), unsigned int), 10, printfParams, 0); // we are using longlong version for every int to save code size.
|
||||
}else
|
||||
#endif
|
||||
#if PRINTF_LITE_SHORTSHORTINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier < 9 ) {
|
||||
print_ulonglong((unsigned char)va_arg(VALIST_ACCESS(valist), unsigned int), 10, printfParams, 0); // we are using longlong version for every int to save code size.
|
||||
}else
|
||||
#endif
|
||||
print_ulonglong(va_arg(VALIST_ACCESS(valist), unsigned int), 10, printfParams, 0);
|
||||
printfParams->inDirective = 0;
|
||||
break;
|
||||
@ -865,13 +888,21 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
else
|
||||
#endif
|
||||
#if PRINTF_LITE_LONGLONGINT_SUPPORT == 1 && PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier == 2 ) print_longlong(va_arg(VALIST_ACCESS(valist), long long int), 10, printfParams); // we are using longlong version for every int to save code size.
|
||||
if ( printfParams->l_modifier > 11 ) print_longlong(va_arg(VALIST_ACCESS(valist), long long int), 10, printfParams); // we are using longlong version for every int to save code size.
|
||||
else
|
||||
#endif
|
||||
#if PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier != 0 ) print_longlong(va_arg(VALIST_ACCESS(valist), long int), 10, printfParams); // we are using longlong version for every int to save code size.
|
||||
if ( printfParams->l_modifier == 11 ) print_longlong(va_arg(VALIST_ACCESS(valist), long int), 10, printfParams); // we are using longlong version for every int to save code size.
|
||||
else
|
||||
#endif
|
||||
// #if PRINTF_LITE_SHORTINT_SUPPORT == 1
|
||||
// if ( printfParams->l_modifier == 9 ) print_longlong(va_arg(VALIST_ACCESS(valist), short int), 10, printfParams); // we are using longlong version for every int to save code size.
|
||||
// else
|
||||
// #endif
|
||||
// #if PRINTF_LITE_SHORTSHORTINT_SUPPORT == 1
|
||||
// if ( printfParams->l_modifier < 9 ) print_longlong(va_arg(VALIST_ACCESS(valist), char), 10, printfParams); // we are using longlong version for every int to save code size.
|
||||
// else
|
||||
// #endif
|
||||
print_longlong(va_arg(VALIST_ACCESS(valist), int), 10, printfParams);
|
||||
printfParams->inDirective = 0;
|
||||
break;
|
||||
@ -893,26 +924,27 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
case 'l':
|
||||
#if PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
printfParams->l_modifier += 1;
|
||||
#endif
|
||||
break;
|
||||
case 'h':
|
||||
#if PRINTF_LITE_LONGINT_SUPPORT == 1
|
||||
printfParams->l_modifier -= 1;
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
case 'c':
|
||||
{
|
||||
int c1 = va_arg(VALIST_ACCESS(valist), int);
|
||||
//#if PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
// if ( printfParams->l_modifier >= 1 ) {
|
||||
// printfParams->printCharFunction((wchar_t)c1, printfParams); // 'char' is promoted to 'int' when passed through '...'
|
||||
// }else
|
||||
//#endif
|
||||
#if PRINTF_UTF8_INPUT_SUPPORT == 1
|
||||
{
|
||||
// wchar_t tmp2 = L'a';
|
||||
// int tmp1 = va_arg(VALIST_ACCESS(valist), int);
|
||||
// int tmp3 = va_arg(VALIST_ACCESS(valist), wchar_t);
|
||||
if ( !printfParams->unicode_output && printfParams->l_modifier == 1 ) {
|
||||
print_char32((char32_t)c1, printfParams);
|
||||
if ( !printfParams->unicode_output && printfParams->l_modifier > 10 ) { // print unicode char to utf8
|
||||
print_char32_as_utf8_string((char32_t)c1, printfParams);
|
||||
}else{
|
||||
print_char_macro((int)c1, printfParams); // 'char' is promoted to 'int' when passed through '...'
|
||||
// c1 might be a char (<255) or a unicode char. UTF16 char < 255 are the same as UTF8. Ne need to check.
|
||||
print_char_macro(c1, printfParams); // 'char' is promoted to 'int' when passed through '...'
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -948,11 +980,11 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
// If both input support disabled, we can't even print "unsupported"
|
||||
# if PRINTF_UTF8_INPUT_SUPPORT == 1 || PRINTF_UNICODE_INPUT_SUPPORT== 1
|
||||
# if PRINTF_UTF8_INPUT_SUPPORT == 0
|
||||
if ( printfParams->l_modifier == 0 ) {
|
||||
if ( printfParams->l_modifier <= 10 ) {
|
||||
va_arg(VALIST_ACCESS(valist), const char*);
|
||||
# endif
|
||||
# if PRINTF_UNICODE_INPUT_SUPPORT == 0
|
||||
if ( printfParams->l_modifier == 1 ) {
|
||||
if ( printfParams->l_modifier > 10 ) {
|
||||
va_arg(VALIST_ACCESS(valist), const wchar_t*);
|
||||
# endif
|
||||
# if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 0
|
||||
@ -967,7 +999,7 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
#endif
|
||||
|
||||
#if PRINTF_UNICODE_INPUT_SUPPORT == 1
|
||||
if ( printfParams->l_modifier == 1 ) {
|
||||
if ( printfParams->l_modifier > 10 ) {
|
||||
const wchar_t* s = va_arg(VALIST_ACCESS(valist), const wchar_t*);
|
||||
if ( printfParams->unicode_output ) {
|
||||
output_wchar_string(s, printfParams);
|
||||
@ -984,7 +1016,7 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
if ( printfParams->unicode_output ) {
|
||||
output_utf8_string_as_wchar(s, printfParams);
|
||||
}else{
|
||||
output_utf8_string(s, printfParams);
|
||||
output_utf8_string_as_utf8(s, printfParams);
|
||||
}
|
||||
#elif PRINTF_UTF8_OUTPUT_SUPPORT == 1
|
||||
output_utf8_string(s, printfParams);
|
||||
@ -1029,7 +1061,7 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
if ( c == '%' )
|
||||
{
|
||||
printfParams->inDirective = 1;
|
||||
printfParams->l_modifier = 0;
|
||||
printfParams->l_modifier = 10;
|
||||
#if PRINTF_LITE_ZSPECIFIER_SUPPORT == 1
|
||||
printfParams->z_modifier = 0;
|
||||
#endif
|
||||
@ -1049,7 +1081,7 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
}
|
||||
else
|
||||
{
|
||||
// print_char(c, printfParams);
|
||||
// print_utf8_char(c, printfParams);
|
||||
print_char_macro(c, printfParams);
|
||||
}
|
||||
}
|
||||
@ -1077,7 +1109,7 @@ void vprintf_with_callback(const char* format, va_list valist, transmitBufCallBa
|
||||
printfParams.inDirective = 0;
|
||||
#if PRINTF_UTF8_OUTPUT_SUPPORT == 1 && PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
printfParams.unicode_output = 0;
|
||||
printfParams.printCharFunction = print_char;
|
||||
printfParams.printCharFunction = print_utf8_char;
|
||||
#endif
|
||||
printfParams.transmitBufCallBack.transmitBufCallBack = transmitBufCallBack;
|
||||
printfParams.context = context;
|
||||
|
@ -1804,7 +1804,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
|
||||
DBG("RsdPointer Acpi 2.0 installed\n");
|
||||
}
|
||||
Xsdt = (XSDT_TABLE*)(UINTN)BufferPtr;
|
||||
// DBG("XSDT = 0x%x\n", Xsdt);
|
||||
// DBG("XSDT = 0x%llx\n", uintptr_t(Xsdt));
|
||||
Xsdt->Header.Signature = 0x54445358; //EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
|
||||
eCntR = (Rsdt->Header.Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / sizeof(UINT32);
|
||||
Xsdt->Header.Length = eCntR * sizeof(UINT64) + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
||||
|
@ -1050,7 +1050,7 @@ PutNvramPlistToRtVars ()
|
||||
if (!GlobalConfig.DebugLog) {
|
||||
DBG ("Size = %lld, Data: ", Size);
|
||||
for (i = 0; i < Size; i++) {
|
||||
DBG("%02X ", *((__typeof__(ValTag->string))Value + i));
|
||||
DBG("%02hhX ", *((__typeof__(ValTag->string))Value + i));
|
||||
}
|
||||
}
|
||||
if (!GlobalConfig.DebugLog) {
|
||||
|
@ -6811,7 +6811,7 @@ GetDevices ()
|
||||
|
||||
default:
|
||||
gfx->Vendor = Unknown;
|
||||
snprintf (gfx->Model, 64, "pci%x,%x", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
|
||||
snprintf (gfx->Model, 64, "pci%hx,%hx", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
|
||||
gfx->Ports = 1;
|
||||
gfx->Connectors = (1 << NGFX);
|
||||
gfx->ConnChanged = FALSE;
|
||||
|
@ -1741,7 +1741,7 @@ FindBootArgs(IN LOADER_ENTRY *Entry)
|
||||
//DBG("bootArgs2->kaddr = 0x%08X and bootArgs2->ksize = 0x%08X\n", bootArgs2->kaddr, bootArgs2->ksize);
|
||||
//DBG("bootArgs2->efiMode = 0x%02X\n", bootArgs2->efiMode);
|
||||
DBG_RT(Entry, "bootArgs2->CommandLine = %s\n", bootArgs2->CommandLine);
|
||||
DBG_RT(Entry, "bootArgs2->flags = 0x%x\n", bootArgs2->flags);
|
||||
DBG_RT(Entry, "bootArgs2->flags = 0x%hx\n", bootArgs2->flags);
|
||||
DBG_RT(Entry, "bootArgs2->kslide = 0x%x\n", bootArgs2->kslide);
|
||||
DBG_RT(Entry, "bootArgs2->bootMemStart = 0x%llx\n", bootArgs2->bootMemStart);
|
||||
if (Entry && Entry->KernelAndKextPatches && Entry->KernelAndKextPatches->KPDebug)
|
||||
|
@ -195,22 +195,22 @@ int BootOptions_tests()
|
||||
CHAR16* LoadOptions3 = Old1_RemoveLoadOption(LoadOptions, L"opt3");
|
||||
if ( XString().takeValueFrom(LoadOptions3) != "opt1 opt2"_XS ) return 1;
|
||||
}
|
||||
{
|
||||
XString LoadOptions;
|
||||
|
||||
LoadOptions = AddLoadOption(LoadOptions, "opt1"_XS);
|
||||
LoadOptions = AddLoadOption(LoadOptions, "opt2"_XS);
|
||||
LoadOptions = AddLoadOption(LoadOptions, "opt3"_XS);
|
||||
|
||||
if ( LoadOptions != "opt1 opt2 opt3"_XS ) return 1;
|
||||
|
||||
XString LoadOptions1 = RemoveLoadOption(LoadOptions, "opt1"_XS);
|
||||
if ( LoadOptions1 != "opt2 opt3"_XS ) return 1;
|
||||
XString LoadOptions2 = RemoveLoadOption(LoadOptions, "opt2"_XS);
|
||||
if ( LoadOptions2 != "opt1 opt3"_XS ) return 1;
|
||||
XString LoadOptions3 = RemoveLoadOption(LoadOptions, "opt3"_XS);
|
||||
if ( LoadOptions3 != "opt1 opt2"_XS ) return 1;
|
||||
}
|
||||
// {
|
||||
// XString LoadOptions;
|
||||
//
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt1"_XS);
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt2"_XS);
|
||||
// LoadOptions = AddLoadOption(LoadOptions, "opt3"_XS);
|
||||
//
|
||||
// if ( LoadOptions != "opt1 opt2 opt3"_XS ) return 1;
|
||||
//
|
||||
// XString LoadOptions1 = RemoveLoadOption(LoadOptions, "opt1"_XS);
|
||||
// if ( LoadOptions1 != "opt2 opt3"_XS ) return 1;
|
||||
// XString LoadOptions2 = RemoveLoadOption(LoadOptions, "opt2"_XS);
|
||||
// if ( LoadOptions2 != "opt1 opt3"_XS ) return 1;
|
||||
// XString LoadOptions3 = RemoveLoadOption(LoadOptions, "opt3"_XS);
|
||||
// if ( LoadOptions3 != "opt1 opt2"_XS ) return 1;
|
||||
// }
|
||||
{
|
||||
XStringArray LoadOptions;
|
||||
|
||||
|
@ -285,6 +285,22 @@ int printf_lite_tests(void)
|
||||
Test1arg(F("| c|"), F("|%5x|"), 12);
|
||||
Test1arg(F("| C|"), F("|%5X|"), 12);
|
||||
|
||||
Test1arg(F("| -12|"), F("|%5hhd|"), (char)-12);
|
||||
Test1arg(F("| -12|"), F("|%5hd|"), (short)-12);
|
||||
Test1arg(F("| -12|"), F("|%5d|"), -12);
|
||||
Test1arg(F("| -12|"), F("|%5ld|"), -12L);
|
||||
Test1arg(F("| -12|"), F("|%5lld|"), -12LL);
|
||||
Test1arg(F("| 244|"), F("|%5hhu|"), (char)-12);
|
||||
Test1arg(F("|65524|"), F("|%5hu|"), (short)-12);
|
||||
Test1arg(F("|4294967284|"), F("|%5u|"), -12);
|
||||
Test1arg(F("|18446744073709551604|"), F("|%5lu|"), -12L);
|
||||
Test1arg(F("|18446744073709551604|"), F("|%5llu|"), -12LL);
|
||||
Test1arg(F("| f4|"), F("|%5hhx|"), (char)-12);
|
||||
Test1arg(F("| fff4|"), F("|%5hx|"), (short)-12);
|
||||
Test1arg(F("|fffffff4|"), F("|%5x|"), -12);
|
||||
Test1arg(F("|fffffffffffffff4|"), F("|%5lx|"), -12L);
|
||||
Test1arg(F("|fffffffffffffff4|"), F("|%5llx|"), -12LL);
|
||||
|
||||
// test pad char but no width (no effect)
|
||||
Test1arg(F("|c|"), F("|%0x|"), 12);
|
||||
Test1arg(F("|C|"), F("|%0X|"), 12);
|
||||
|
@ -304,7 +304,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
||||
DBG("codepage=%llx, asciiPage=%x\n", GlobalConfig.Codepage, AsciiPageSize);
|
||||
for (UINTN i = 0; i < TextLength && c0 != 0; i++) {
|
||||
UINT16 c = Text.wc_str()[i]; //including UTF8 -> UTF16 conversion
|
||||
DBG("initial char to render 0x%x\n", c); //good
|
||||
DBG("initial char to render 0x%hx\n", c); //good
|
||||
if (gLanguage != korean) { //russian Codepage = 0x410
|
||||
if (c >= 0x410 && c < 0x450) {
|
||||
//we have russian raster fonts with chars at 0xC0
|
||||
@ -313,7 +313,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
||||
INTN c2 = (c >= GlobalConfig.Codepage) ? (c - GlobalConfig.Codepage + AsciiPageSize) : c; //International letters
|
||||
c = c2 & 0xFF; //this maximum raster font size
|
||||
}
|
||||
// DBG("char to render 0x%x\n", c);
|
||||
// DBG("char to render 0x%hhx\n", c);
|
||||
if (Proportional) {
|
||||
//find spaces {---comp--__left__|__right__--char---}
|
||||
if (c0 <= 0x20) { // space before or at buffer edge
|
||||
|
@ -1745,10 +1745,10 @@ VOID SetOEMPath(CONST CHAR16 *ConfName)
|
||||
OEMPath = PoolPrint(L"%s", L"EFI\\CLOVER");
|
||||
if (ConfName == NULL) {
|
||||
DBG ("set OEMPath (ConfName == NULL): %ls\n", OEMPath);
|
||||
} else if ( nLanCards > 0 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) {
|
||||
} else if ( nLanCards > 1 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) {
|
||||
} else if ( nLanCards > 2 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) {
|
||||
} else if ( nLanCards > 3 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02x-%02x-%02x-%02x-%02x-%02x", gSettings.OEMProduct, gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) {
|
||||
} else if ( nLanCards > 0 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx", gSettings.OEMProduct, gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) {
|
||||
} else if ( nLanCards > 1 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx", gSettings.OEMProduct, gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) {
|
||||
} else if ( nLanCards > 2 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx", gSettings.OEMProduct, gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) {
|
||||
} else if ( nLanCards > 3 && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a--%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx", gSettings.OEMProduct, gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) {
|
||||
} else if (!gFirmwareClover && SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a\\UEFI", gSettings.OEMBoard), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a", gSettings.OEMProduct), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, PoolPrint(L"EFI\\CLOVER\\OEM\\%a-%d", gSettings.OEMProduct, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName)) {
|
||||
|
@ -1700,9 +1700,9 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
|
||||
}
|
||||
|
||||
} else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) {
|
||||
ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04x]->", gSettings.BooterConfig); // TODO jief : cast to fix
|
||||
ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04hx]->", gSettings.BooterConfig); // TODO jief : cast to fix
|
||||
} else if (ChosenEntry->SubScreen->ID == SCREEN_DSM) {
|
||||
ChosenEntry->Title.SWPrintf("Drop OEM _DSM [0x%04x]->", dropDSM); // TODO jief : cast to fix
|
||||
ChosenEntry->Title.SWPrintf("Drop OEM _DSM [0x%04hx]->", dropDSM); // TODO jief : cast to fix
|
||||
}
|
||||
}
|
||||
|
||||
@ -1724,7 +1724,7 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
|
||||
|
||||
for (i = 0; i < NGFX; i++) {
|
||||
SubScreen->AddMenuInfo_f("----------------------");
|
||||
SubScreen->AddMenuInfo_f("Card DeviceID=%04x", gGraphics[i].DeviceID);
|
||||
SubScreen->AddMenuInfo_f("Card DeviceID=%04hx", gGraphics[i].DeviceID);
|
||||
N = 20 + i * 6;
|
||||
SubScreen->AddMenuItemInput(N, "Model:", TRUE);
|
||||
|
||||
@ -2265,7 +2265,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM()
|
||||
|
||||
// create the entry in the main menu
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSM, NULL);
|
||||
// Entry->Title.SPrintf("Drop OEM _DSM [0x%04x]->", gSettings.DropOEM_DSM);
|
||||
// Entry->Title.SPrintf("Drop OEM _DSM [0x%04hhx]->", gSettings.DropOEM_DSM);
|
||||
|
||||
// submenu description
|
||||
SubScreen->AddMenuInfoLine_f("Choose devices to drop OEM _DSM methods from DSDT");
|
||||
@ -2298,7 +2298,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
|
||||
// REFIT_INPUT_DIALOG *InputBootArgs;
|
||||
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT, NULL);
|
||||
// Entry->Title.SPrintf("DSDT fix mask [0x%08x]->", gSettings.FixDsdt);
|
||||
// Entry->Title.SPrintf("DSDT fix mask [0x%08hhx]->", gSettings.FixDsdt);
|
||||
|
||||
SubScreen->AddMenuCheck("Add DTGP", FIX_DTGP, 67);
|
||||
SubScreen->AddMenuCheck("Fix Darwin as WinXP", FIX_WARNING, 67);
|
||||
@ -2646,7 +2646,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuBLC()
|
||||
|
||||
// create the entry in the main menu
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BLC, NULL);
|
||||
// Entry->Title.SPrintf("boot_args->flags [0x%02x]->", gSettings.BooterConfig);
|
||||
// Entry->Title.SPrintf("boot_args->flags [0x%02hhx]->", gSettings.BooterConfig);
|
||||
|
||||
// submenu description
|
||||
SubScreen->AddMenuInfoLine_f("Modify flags for boot.efi");
|
||||
|
Loading…
Reference in New Issue
Block a user