mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
improve oem string, refactor font name
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
commit
6039faefa2
@ -268,10 +268,12 @@ static void print_char32(const char32_t utf32_char, PrintfParams* printfParams)
|
||||
* Print wchar string to utf8 string.
|
||||
* Only needed if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 1
|
||||
*/
|
||||
static void print_wchar_string(const wchar_t* s, PrintfParams* printfParams)
|
||||
static void output_wchar_string_as_utf8(const wchar_t* s, PrintfParams* printfParams)
|
||||
{
|
||||
if ( !s ) return;
|
||||
while ( *s ) {
|
||||
int width_specifier = printfParams->width_specifier;
|
||||
while ( *s && (printfParams->width_specifier == 0 || width_specifier--) ) {
|
||||
// while ( *s ) {
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
const char16_t uc = *s++;
|
||||
if (!printf_is_surrogate(uc)) {
|
||||
@ -311,95 +313,20 @@ UTF8
|
||||
|
||||
|
||||
|
||||
#if PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
/*
|
||||
*
|
||||
* Only needed if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 1
|
||||
*/
|
||||
static const char* get_utf32_from_utf8(const char* s, char32_t* utf32_letter)
|
||||
{
|
||||
tryagain:
|
||||
if ( *((unsigned char*)s) & 0x80 ) {
|
||||
// if Byte 1 is 1xxxxxxx : multi byte is at least 2 char
|
||||
if (*(s+1) == 0) {
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
return NULL;
|
||||
}
|
||||
// Byte 2 should be 0b10xxxxxx
|
||||
if ((*(((unsigned char*)s)+1) & 0xc0) != 0x80) { // 0xC0 = 0b11000000
|
||||
// second byte is not multi byte char, ignore
|
||||
s += 1;
|
||||
goto tryagain;
|
||||
}
|
||||
// if Byte 1 is 111xxxxx : multi byte is at least 3 char
|
||||
if ((*((unsigned char*)s) & 0xe0) == 0xe0) { // 0xE0 = 0b11100000
|
||||
if (*(s+2) == 0) {
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
return NULL;
|
||||
}
|
||||
// Byte 3 should be 0b10xxxxxx
|
||||
if ((*(((unsigned char*)s)+2) & 0xc0) != 0x80) {
|
||||
s += 1;
|
||||
goto tryagain;
|
||||
}
|
||||
// if Byte 1 is 1111xxxx : multi byte is 4 char
|
||||
if ((*((unsigned char*)s) & 0xf0) == 0xf0) { // 0xF0 = 0b11110000
|
||||
if (*(s+3) == 0) {
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
return NULL;
|
||||
}
|
||||
// if Byte 1 is not 0b11110xxx || Byte 4 not 0b10xxxxxx
|
||||
if ((*((unsigned char*)s) & 0xf8) != 0xf0 || (*(((unsigned char*)s)+3) & 0xc0) != 0x80) {
|
||||
s += 1;
|
||||
goto tryagain;
|
||||
}
|
||||
/* 4-byte code */
|
||||
*utf32_letter = (char32_t)((*((char32_t*)s) & 0x7) << 18);
|
||||
*utf32_letter |= (char32_t)((*(((unsigned char*)s)+1) & 0x3f) << 12);
|
||||
*utf32_letter |= (char32_t)((*(((unsigned char*)s)+2) & 0x3f) << 6);
|
||||
*utf32_letter |= *(((unsigned char*)s)+3) & 0x3f;
|
||||
return s + 4;
|
||||
} else {
|
||||
/* 3-byte code */
|
||||
*utf32_letter = (char32_t)((*((unsigned char*)s) & 0xf) << 12);
|
||||
*utf32_letter |= (char32_t)((*(((unsigned char*)s)+1) & 0x3f) << 6);
|
||||
*utf32_letter |= *(((unsigned char*)s)+2) & 0x3f;
|
||||
return s + 3;
|
||||
}
|
||||
} else {
|
||||
/* 2-byte code */
|
||||
*utf32_letter = (char32_t)((*((unsigned char*)s) & 0x1f) << 6);
|
||||
*utf32_letter |= *(((unsigned char*)s)+1) & 0x3f;
|
||||
return s + 2;
|
||||
}
|
||||
} else {
|
||||
/* 1-byte code */
|
||||
*utf32_letter = *((unsigned char*)s);
|
||||
return s + 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 1
|
||||
|
||||
#define halfBase 0x0010000UL
|
||||
#define halfMask 0x3FFUL
|
||||
#define halfShift 10 /* used for shifting by 10 bits */
|
||||
#define UNI_SUR_HIGH_START 0xD800u
|
||||
#define UNI_SUR_LOW_START 0xDC00u
|
||||
|
||||
/*
|
||||
* Print UTF8 string to wchar string.
|
||||
* Only needed if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 1
|
||||
*/
|
||||
static void print_utf8_to_wchar_string(const char* s, PrintfParams* printfParams)
|
||||
static void output_utf8_string_as_wchar(const char* s, PrintfParams* printfParams)
|
||||
{
|
||||
if ( !s ) return;
|
||||
while ( *s ) {
|
||||
int width_specifier = printfParams->width_specifier;
|
||||
while ( *s && (printfParams->width_specifier == 0 || width_specifier--) ) {
|
||||
char32_t c;
|
||||
if ( *((unsigned char*)s) & 0x80 ) {
|
||||
if (*(s+1) == 0) {
|
||||
@ -471,19 +398,28 @@ static void print_utf8_to_wchar_string(const char* s, PrintfParams* printfParams
|
||||
* Print string with no conversion
|
||||
*/
|
||||
#if DEFINE_SECTIONS == 1
|
||||
__attribute__((noinline, section(".print_string")))
|
||||
__attribute__((noinline, section(".output_utf8_string")))
|
||||
#elif DEFINE_SECTIONS == 2
|
||||
__attribute__((noinline, section(".printf_lite")))
|
||||
#endif
|
||||
static void print_string(const char* s, PrintfParams* printfParams)
|
||||
static void output_utf8_string(const char* s, PrintfParams* printfParams)
|
||||
{
|
||||
if ( s ) while ( *s ) print_char(*s++, 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 DEFINE_SECTIONS == 1
|
||||
__attribute__((noinline, section(".output_wchar_string")))
|
||||
#elif DEFINE_SECTIONS == 2
|
||||
__attribute__((noinline, section(".printf_lite")))
|
||||
#endif
|
||||
#if PRINTF_UNICODE_OUTPUT_SUPPORT
|
||||
static void wprint_string(const wchar_t* s, PrintfParams* printfParams)
|
||||
static void output_wchar_string(const wchar_t* s, PrintfParams* printfParams)
|
||||
{
|
||||
if ( s ) while ( *s ) print_wchar(*s++, printfParams);
|
||||
if ( !s ) return;
|
||||
if ( printfParams->width_specifier ) while ( *s && printfParams->width_specifier-- ) print_wchar(*s++, printfParams);
|
||||
else while ( *s ) print_wchar(*s++, printfParams);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -721,9 +657,9 @@ static void print_double(double number, PrintfParams* printfParams)
|
||||
print_char_macro('-', printfParams);
|
||||
}
|
||||
#if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_OUTPUT_SUPPORT == 0
|
||||
print_string(L"<large double>", printfParams);
|
||||
output_utf8_string(L"<large double>", printfParams);
|
||||
#else
|
||||
print_string("<large double>", printfParams);
|
||||
output_utf8_string("<large double>", printfParams);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1020,9 +956,9 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
va_arg(VALIST_ACCESS(valist), const wchar_t*);
|
||||
# endif
|
||||
# if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 0
|
||||
print_string(L"unsupported", printfParams);
|
||||
output_utf8_string(L"unsupported", printfParams);
|
||||
# else
|
||||
print_string("unsupported", printfParams);
|
||||
output_utf8_string("unsupported", printfParams);
|
||||
# endif
|
||||
printfParams->inDirective = 0;
|
||||
}
|
||||
@ -1034,9 +970,9 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
if ( printfParams->l_modifier == 1 ) {
|
||||
const wchar_t* s = va_arg(VALIST_ACCESS(valist), const wchar_t*);
|
||||
if ( printfParams->unicode_output ) {
|
||||
wprint_string(s, printfParams);
|
||||
output_wchar_string(s, printfParams);
|
||||
}else{
|
||||
print_wchar_string(s, printfParams);
|
||||
output_wchar_string_as_utf8(s, printfParams);
|
||||
}
|
||||
printfParams->inDirective = 0;
|
||||
}else
|
||||
@ -1046,38 +982,38 @@ void printf_handle_format_char(char c, VALIST_PARAM_TYPE valist, PrintfParams* p
|
||||
const char* s = va_arg(VALIST_ACCESS(valist), const char*);
|
||||
#if PRINTF_UTF8_OUTPUT_SUPPORT == 1 && PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
if ( printfParams->unicode_output ) {
|
||||
print_utf8_to_wchar_string(s, printfParams);
|
||||
output_utf8_string_as_wchar(s, printfParams);
|
||||
}else{
|
||||
print_string(s, printfParams);
|
||||
output_utf8_string(s, printfParams);
|
||||
}
|
||||
#elif PRINTF_UTF8_OUTPUT_SUPPORT == 1
|
||||
print_string(s, printfParams);
|
||||
output_utf8_string(s, printfParams);
|
||||
#elif PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
print_utf8_to_wchar_string(s, printfParams);
|
||||
output_utf8_string_as_wchar(s, printfParams);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
printfParams->inDirective = 0;
|
||||
}
|
||||
// {
|
||||
// print_string(va_arg(VALIST_ACCESS(valist), const output_char_type*), printfParams);
|
||||
// output_utf8_string(va_arg(VALIST_ACCESS(valist), const output_char_type*), printfParams);
|
||||
// printfParams->inDirective = 0;
|
||||
// }
|
||||
|
||||
//#if PRINTF_UNICODE_INPUT_SUPPORT == 1 && PRINTF_UTF8_OUTPUT_SUPPORT == 1
|
||||
// if ( printfParams->l_modifier == 0 ) {
|
||||
// print_string(va_arg(VALIST_ACCESS(valist), const char*), printfParams);
|
||||
// output_utf8_string(va_arg(VALIST_ACCESS(valist), const char*), printfParams);
|
||||
// printfParams->inDirective = 0;
|
||||
// }else
|
||||
//#elif PRINTF_UTF8_INPUT_SUPPORT == 1 && PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
//#arning TODO
|
||||
// if ( printfParams->l_modifier == 1 ) {
|
||||
// print_string(va_arg(VALIST_ACCESS(valist), const char*), printfParams);
|
||||
// output_utf8_string(va_arg(VALIST_ACCESS(valist), const char*), printfParams);
|
||||
// printfParams->inDirective = 0;
|
||||
// }else
|
||||
//#endif
|
||||
// {
|
||||
// print_string(va_arg(VALIST_ACCESS(valist), const output_char_type*), printfParams);
|
||||
// output_utf8_string(va_arg(VALIST_ACCESS(valist), const output_char_type*), printfParams);
|
||||
// printfParams->inDirective = 0;
|
||||
// }
|
||||
break;
|
||||
@ -1186,6 +1122,74 @@ void printf_with_callback(const char* format, transmitBufCallBackType transmitBu
|
||||
|
||||
#if PRINTF_UNICODE_OUTPUT_SUPPORT == 1
|
||||
|
||||
/*
|
||||
*
|
||||
* Only needed if PRINTF_UNICODE_OUTPUT_SUPPORT == 1 && PRINTF_UTF8_INPUT_SUPPORT == 1
|
||||
*/
|
||||
static const char* get_utf32_from_utf8(const char* s, char32_t* utf32_letter)
|
||||
{
|
||||
tryagain:
|
||||
if ( *((unsigned char*)s) & 0x80 ) {
|
||||
// if Byte 1 is 1xxxxxxx : multi byte is at least 2 char
|
||||
if (*(s+1) == 0) {
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
return NULL;
|
||||
}
|
||||
// Byte 2 should be 0b10xxxxxx
|
||||
if ((*(((unsigned char*)s)+1) & 0xc0) != 0x80) { // 0xC0 = 0b11000000
|
||||
// second byte is not multi byte char, ignore
|
||||
s += 1;
|
||||
goto tryagain;
|
||||
}
|
||||
// if Byte 1 is 111xxxxx : multi byte is at least 3 char
|
||||
if ((*((unsigned char*)s) & 0xe0) == 0xe0) { // 0xE0 = 0b11100000
|
||||
if (*(s+2) == 0) {
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
return NULL;
|
||||
}
|
||||
// Byte 3 should be 0b10xxxxxx
|
||||
if ((*(((unsigned char*)s)+2) & 0xc0) != 0x80) {
|
||||
s += 1;
|
||||
goto tryagain;
|
||||
}
|
||||
// if Byte 1 is 1111xxxx : multi byte is 4 char
|
||||
if ((*((unsigned char*)s) & 0xf0) == 0xf0) { // 0xF0 = 0b11110000
|
||||
if (*(s+3) == 0) {
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
return NULL;
|
||||
}
|
||||
// if Byte 1 is not 0b11110xxx || Byte 4 not 0b10xxxxxx
|
||||
if ((*((unsigned char*)s) & 0xf8) != 0xf0 || (*(((unsigned char*)s)+3) & 0xc0) != 0x80) {
|
||||
s += 1;
|
||||
goto tryagain;
|
||||
}
|
||||
/* 4-byte code */
|
||||
*utf32_letter = (char32_t)((*((char32_t*)s) & 0x7) << 18);
|
||||
*utf32_letter |= (char32_t)((*(((unsigned char*)s)+1) & 0x3f) << 12);
|
||||
*utf32_letter |= (char32_t)((*(((unsigned char*)s)+2) & 0x3f) << 6);
|
||||
*utf32_letter |= *(((unsigned char*)s)+3) & 0x3f;
|
||||
return s + 4;
|
||||
} else {
|
||||
/* 3-byte code */
|
||||
*utf32_letter = (char32_t)((*((unsigned char*)s) & 0xf) << 12);
|
||||
*utf32_letter |= (char32_t)((*(((unsigned char*)s)+1) & 0x3f) << 6);
|
||||
*utf32_letter |= *(((unsigned char*)s)+2) & 0x3f;
|
||||
return s + 3;
|
||||
}
|
||||
} else {
|
||||
/* 2-byte code */
|
||||
*utf32_letter = (char32_t)((*((unsigned char*)s) & 0x1f) << 6);
|
||||
*utf32_letter |= *(((unsigned char*)s)+1) & 0x3f;
|
||||
return s + 2;
|
||||
}
|
||||
} else {
|
||||
/* 1-byte code */
|
||||
*utf32_letter = *((unsigned char*)s);
|
||||
return s + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vwprintf_with_callback(const char* format, va_list valist, transmitWBufCallBackType transmitWBufCallBack, void* context
|
||||
#if PRINTF_LITE_TIMESTAMP_SUPPORT == 1
|
||||
, int* newline, int timestamp
|
||||
|
@ -7,6 +7,10 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
9A014999244091B200B37399 /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; };
|
||||
9A01499A244091B200B37399 /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; };
|
||||
9A01499B244091B300B37399 /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; };
|
||||
9A01499C244091B300B37399 /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; };
|
||||
9A09863124389A6A00826276 /* menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A09863024389A6A00826276 /* menu.cpp */; };
|
||||
9A09863224389A6A00826276 /* menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A09863024389A6A00826276 /* menu.cpp */; };
|
||||
9A09863324389A6A00826276 /* menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A09863024389A6A00826276 /* menu.cpp */; };
|
||||
@ -60,7 +64,6 @@
|
||||
9A9AEB9D243F7B9000FBD7D8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB91243F7B5600FBD7D8 /* XStringArray.cpp */; };
|
||||
9A9AEB9E243F7B9100FBD7D8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB91243F7B5600FBD7D8 /* XStringArray.cpp */; };
|
||||
9A9AEB9F243F7B9200FBD7D8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB91243F7B5600FBD7D8 /* XStringArray.cpp */; };
|
||||
9A9D3B2224221563006D8CD9 /* printf_lite_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9D3B2024221562006D8CD9 /* printf_lite_test.h */; };
|
||||
9A9D3B2324221563006D8CD9 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */; };
|
||||
9A9D3B2D242215A1006D8CD9 /* stdio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9D3B28242215A1006D8CD9 /* stdio.cpp */; };
|
||||
9A9D3B2E242215A1006D8CD9 /* stdio.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9D3B29242215A1006D8CD9 /* stdio.h */; };
|
||||
@ -293,7 +296,6 @@
|
||||
9ACFE68F24309AF80071CC93 /* limits.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC9B241B66EA00F3D247 /* limits.h */; };
|
||||
9ACFE69024309AF80071CC93 /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2524176C04005CDD5C /* Settings.h */; };
|
||||
9ACFE69124309AF80071CC93 /* XStringW_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED224176C04005CDD5C /* XStringW_test.h */; };
|
||||
9ACFE69224309AF80071CC93 /* printf_lite_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9D3B2024221562006D8CD9 /* printf_lite_test.h */; };
|
||||
9ACFE69324309AF80071CC93 /* ati_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4F24176C04005CDD5C /* ati_reg.h */; };
|
||||
9ACFE69424309AF80071CC93 /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9ACFE69524309AF80071CC93 /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
@ -497,7 +499,6 @@
|
||||
9AF415C5242CD75C00D2644C /* limits.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC9B241B66EA00F3D247 /* limits.h */; };
|
||||
9AF415C6242CD75C00D2644C /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2524176C04005CDD5C /* Settings.h */; };
|
||||
9AF415C7242CD75C00D2644C /* XStringW_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED224176C04005CDD5C /* XStringW_test.h */; };
|
||||
9AF415C8242CD75C00D2644C /* printf_lite_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9D3B2024221562006D8CD9 /* printf_lite_test.h */; };
|
||||
9AF415C9242CD75C00D2644C /* ati_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4F24176C04005CDD5C /* ati_reg.h */; };
|
||||
9AF415CA242CD75C00D2644C /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9AF415CB242CD75C00D2644C /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
@ -693,7 +694,6 @@
|
||||
9AF416A2242CDA5800D2644C /* limits.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A28CC9B241B66EA00F3D247 /* limits.h */; };
|
||||
9AF416A3242CDA5800D2644C /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2524176C04005CDD5C /* Settings.h */; };
|
||||
9AF416A4242CDA5800D2644C /* XStringW_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED224176C04005CDD5C /* XStringW_test.h */; };
|
||||
9AF416A5242CDA5800D2644C /* printf_lite_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A9D3B2024221562006D8CD9 /* printf_lite_test.h */; };
|
||||
9AF416A6242CDA5800D2644C /* ati_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4F24176C04005CDD5C /* ati_reg.h */; };
|
||||
9AF416A7242CDA5800D2644C /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9AF416A8242CDA5800D2644C /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
@ -866,7 +866,6 @@
|
||||
9A9AEB92243F7B5600FBD7D8 /* XStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray.h; sourceTree = "<group>"; };
|
||||
9A9AEB93243F7B5600FBD7D8 /* unicode_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unicode_conversions.h; sourceTree = "<group>"; };
|
||||
9A9AEB98243F7B7900FBD7D8 /* printf_lite-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test.h"; sourceTree = "<group>"; };
|
||||
9A9D3B2024221562006D8CD9 /* printf_lite_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = printf_lite_test.h; sourceTree = "<group>"; };
|
||||
9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printf_lite-test.cpp"; sourceTree = "<group>"; };
|
||||
9A9D3B28242215A1006D8CD9 /* stdio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = stdio.cpp; sourceTree = "<group>"; };
|
||||
9A9D3B29242215A1006D8CD9 /* stdio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdio.h; sourceTree = "<group>"; };
|
||||
@ -1165,7 +1164,6 @@
|
||||
9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */,
|
||||
9AF4155C242B8FA300D2644C /* poolprint-test.cpp */,
|
||||
9AF4155B242B8FA300D2644C /* poolprint-test.h */,
|
||||
9A9D3B2024221562006D8CD9 /* printf_lite_test.h */,
|
||||
9AF41565242BAD5600D2644C /* printf_lite-test-cpp_conf.h */,
|
||||
9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */,
|
||||
9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */,
|
||||
@ -1492,7 +1490,6 @@
|
||||
9A28CCA4241B66EA00F3D247 /* limits.h in Headers */,
|
||||
9AC7800E24176C04005CDD5C /* Settings.h in Headers */,
|
||||
9AC77FBF24176C04005CDD5C /* XStringW_test.h in Headers */,
|
||||
9A9D3B2224221563006D8CD9 /* printf_lite_test.h in Headers */,
|
||||
9AC7803824176C04005CDD5C /* ati_reg.h in Headers */,
|
||||
9AC7804824176C04005CDD5C /* libegint.h in Headers */,
|
||||
9AC7800624176C04005CDD5C /* memvendors.h in Headers */,
|
||||
@ -1599,7 +1596,6 @@
|
||||
9ACFE68F24309AF80071CC93 /* limits.h in Headers */,
|
||||
9ACFE69024309AF80071CC93 /* Settings.h in Headers */,
|
||||
9ACFE69124309AF80071CC93 /* XStringW_test.h in Headers */,
|
||||
9ACFE69224309AF80071CC93 /* printf_lite_test.h in Headers */,
|
||||
9ACFE69324309AF80071CC93 /* ati_reg.h in Headers */,
|
||||
9ACFE69424309AF80071CC93 /* libegint.h in Headers */,
|
||||
9ACFE69524309AF80071CC93 /* memvendors.h in Headers */,
|
||||
@ -1705,7 +1701,6 @@
|
||||
9AF415C5242CD75C00D2644C /* limits.h in Headers */,
|
||||
9AF415C6242CD75C00D2644C /* Settings.h in Headers */,
|
||||
9AF415C7242CD75C00D2644C /* XStringW_test.h in Headers */,
|
||||
9AF415C8242CD75C00D2644C /* printf_lite_test.h in Headers */,
|
||||
9AF415C9242CD75C00D2644C /* ati_reg.h in Headers */,
|
||||
9AF415CA242CD75C00D2644C /* libegint.h in Headers */,
|
||||
9AF415CB242CD75C00D2644C /* memvendors.h in Headers */,
|
||||
@ -1809,7 +1804,6 @@
|
||||
9AF416A2242CDA5800D2644C /* limits.h in Headers */,
|
||||
9AF416A3242CDA5800D2644C /* Settings.h in Headers */,
|
||||
9AF416A4242CDA5800D2644C /* XStringW_test.h in Headers */,
|
||||
9AF416A5242CDA5800D2644C /* printf_lite_test.h in Headers */,
|
||||
9AF416A6242CDA5800D2644C /* ati_reg.h in Headers */,
|
||||
9AF416A7242CDA5800D2644C /* libegint.h in Headers */,
|
||||
9AF416A8242CDA5800D2644C /* memvendors.h in Headers */,
|
||||
@ -2061,6 +2055,7 @@
|
||||
9A9AEB95243F7B5600FBD7D8 /* XStringArray.cpp in Sources */,
|
||||
9AC7800A24176C04005CDD5C /* StateGenerator.cpp in Sources */,
|
||||
9AC7805C24176C04005CDD5C /* XImage.cpp in Sources */,
|
||||
9A014999244091B200B37399 /* printlib-test.cpp in Sources */,
|
||||
9AC7802B24176C04005CDD5C /* platformdata.cpp in Sources */,
|
||||
9A28CD29241BC0C700F3D247 /* strcmp.cpp in Sources */,
|
||||
9AC7805724176C04005CDD5C /* XPointer.cpp in Sources */,
|
||||
@ -2176,6 +2171,7 @@
|
||||
9ACFE6D324309AF80071CC93 /* StateGenerator.cpp in Sources */,
|
||||
9ACFE6D424309AF80071CC93 /* XImage.cpp in Sources */,
|
||||
9ACFE6D524309AF80071CC93 /* platformdata.cpp in Sources */,
|
||||
9A01499C244091B300B37399 /* printlib-test.cpp in Sources */,
|
||||
9ACFE6D624309AF80071CC93 /* strcmp.cpp in Sources */,
|
||||
9ACFE6D724309AF80071CC93 /* XPointer.cpp in Sources */,
|
||||
9ACFE6D824309AF80071CC93 /* strncmp_test.cpp in Sources */,
|
||||
@ -2291,6 +2287,7 @@
|
||||
9AF41608242CD75C00D2644C /* StateGenerator.cpp in Sources */,
|
||||
9AF41609242CD75C00D2644C /* XImage.cpp in Sources */,
|
||||
9AF4160A242CD75C00D2644C /* platformdata.cpp in Sources */,
|
||||
9A01499A244091B200B37399 /* printlib-test.cpp in Sources */,
|
||||
9AF4160B242CD75C00D2644C /* strcmp.cpp in Sources */,
|
||||
9AF4160C242CD75C00D2644C /* XPointer.cpp in Sources */,
|
||||
9AF4160D242CD75C00D2644C /* strncmp_test.cpp in Sources */,
|
||||
@ -2406,6 +2403,7 @@
|
||||
9AF416E5242CDA5800D2644C /* StateGenerator.cpp in Sources */,
|
||||
9AF416E6242CDA5800D2644C /* XImage.cpp in Sources */,
|
||||
9AF416E7242CDA5800D2644C /* platformdata.cpp in Sources */,
|
||||
9A01499B244091B300B37399 /* printlib-test.cpp in Sources */,
|
||||
9AF416E8242CDA5800D2644C /* strcmp.cpp in Sources */,
|
||||
9AF416E9242CDA5800D2644C /* XPointer.cpp in Sources */,
|
||||
9AF416EA242CDA5800D2644C /* strncmp_test.cpp in Sources */,
|
||||
|
@ -1068,7 +1068,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
if (!acpi_cpu_count) {
|
||||
for (i=0; i < acpi_cpu_max; i++) {
|
||||
acpi_cpu_name[i] = (__typeof_am__(acpi_cpu_name[i]))AllocateZeroPool(5);
|
||||
AsciiSPrint(acpi_cpu_name[i], 5, "CPU%1x", i);
|
||||
snprintf(acpi_cpu_name[i], 5, "CPU%X", i);
|
||||
acpi_cpu_processor_id[i] = (UINT8)(i & 0x7F);
|
||||
}
|
||||
}
|
||||
@ -2438,7 +2438,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
|
||||
pack = aml_add_package(met);
|
||||
aml_add_string(pack, "device-id");
|
||||
aml_add_byte_buffer(pack, dataLPC, 4);
|
||||
AsciiSPrint(NameCard, sizeof(NameCard), "pci8086,3a18");
|
||||
snprintf(NameCard, sizeof(NameCard), "pci8086,3a18");
|
||||
aml_add_string(pack, "name");
|
||||
aml_add_string_buffer(pack, &NameCard[0]);
|
||||
aml_add_string(pack, "compatible");
|
||||
@ -2961,7 +2961,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
|
||||
if (gSettings.FakeLAN) {
|
||||
FakeID = gSettings.FakeLAN >> 16;
|
||||
FakeVen = gSettings.FakeLAN & 0xFFFF;
|
||||
AsciiSPrint(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID);
|
||||
snprintf(NameCard, 32, "pci%04X,%04X", FakeVen, FakeID);
|
||||
LowCase(NameCard);
|
||||
Netmodel[card] = get_net_model((FakeVen << 16) + FakeID);
|
||||
}
|
||||
@ -3164,7 +3164,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
|
||||
if (gSettings.FakeWIFI) {
|
||||
FakeID = gSettings.FakeWIFI >> 16;
|
||||
FakeVen = gSettings.FakeWIFI & 0xFFFF;
|
||||
AsciiSPrint(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID);
|
||||
snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID);
|
||||
LowCase(NameCard);
|
||||
}
|
||||
|
||||
@ -4052,8 +4052,8 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
if (usb > 0) {
|
||||
|
||||
for (i = 0; i < usb; i++) {
|
||||
INTN XhciCount = 1;
|
||||
INTN EhciCount = 0;
|
||||
INT32 XhciCount = 1;
|
||||
INT32 EhciCount = 0;
|
||||
// find USB adr
|
||||
for (j = 0x20; len >= 4 && j < len - 4; j++) {
|
||||
if (CmpAdr(dsdt, j, USBADR[i])) { //j+4 -> _ADR
|
||||
@ -4081,18 +4081,18 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
USBADR[i], USBADR2[i], k, device_name[10]);
|
||||
if (USB30[i]) {
|
||||
if (gSettings.NameXH00) {
|
||||
AsciiSPrint(UsbName[i], 5, "XH%02x", XhciCount++);
|
||||
snprintf(UsbName[i], 5, "XH%02x", XhciCount++);
|
||||
} else {
|
||||
AsciiSPrint(UsbName[i], 5, "XHC%01x", XhciCount++);
|
||||
snprintf(UsbName[i], 5, "XHC%01x", XhciCount++);
|
||||
}
|
||||
} else if (USB20[i]) {
|
||||
if (gSettings.NameEH00) {
|
||||
AsciiSPrint(UsbName[i], 5, "EH%02x", EhciCount++);
|
||||
snprintf(UsbName[i], 5, "EH%02x", EhciCount++);
|
||||
} else {
|
||||
AsciiSPrint(UsbName[i], 5, "EHC%01x", EhciCount++);
|
||||
snprintf(UsbName[i], 5, "EHC%01x", EhciCount++);
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint(UsbName[i], 5, "USB%01d", i);
|
||||
snprintf(UsbName[i], 5, "USB%d", i); // %01d is strictly the same as %d
|
||||
}
|
||||
DBG(" %s\n", UsbName[i]);
|
||||
ReplaceName(dsdt + adr1, Size, device_name[10], UsbName[i]);
|
||||
|
@ -4259,17 +4259,17 @@ ParseSMBIOSSettings(
|
||||
} else if ((i[3] == j[3]) && (i[4] == j[4])) {
|
||||
//DBG ("Found same BiosReleaseDate in clover and config\n");
|
||||
} else {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
@ -4316,17 +4316,17 @@ ParseSMBIOSSettings(
|
||||
} else if ((i[3] == j[3]) && (i[4] == j[4])) {
|
||||
//DBG ("Found same BiosReleaseDate in clover and config\n");
|
||||
} else {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
} else {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using latest BiosReleaseDate from config\n");
|
||||
}
|
||||
@ -4342,11 +4342,11 @@ ParseSMBIOSSettings(
|
||||
}
|
||||
|
||||
if ((AsciiStrLen(i) == 8)) {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("Using the date of used BiosVersion\n");
|
||||
} else if ((AsciiStrLen(i) == 10)) {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("Using the date of used BiosVersion\n");
|
||||
}
|
||||
@ -4369,11 +4369,11 @@ ParseSMBIOSSettings(
|
||||
}
|
||||
|
||||
if ((AsciiStrLen(i) == 8)) {
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
//DBG ("BiosReleaseDate: not set, Using the date of used BiosVersion\n");
|
||||
} else if ((AsciiStrLen(i) == 10)) {
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
//DBG ("BiosReleaseDate: not set, Using the date of used BiosVersion\n");
|
||||
}
|
||||
@ -4852,7 +4852,7 @@ GetUserSettings(
|
||||
}
|
||||
Dict2 = GetProperty (Prop2, "PciAddr");
|
||||
if (Dict2 != NULL) {
|
||||
INTN Bus, Dev, Func;
|
||||
UINT8 Bus, Dev, Func;
|
||||
CHAR8 *Str = Dict2->string;
|
||||
|
||||
if (Str[2] != ':') {
|
||||
@ -4864,7 +4864,7 @@ GetUserSettings(
|
||||
Dev = hexstrtouint8(&Str[3]);
|
||||
Func = hexstrtouint8(&Str[6]);
|
||||
DeviceAddr = PCIADDR(Bus, Dev, Func);
|
||||
AsciiSPrint(Label, 64, "[%02x:%02x.%02x] ", Bus, Dev, Func);
|
||||
snprintf(Label, 64, "[%02X:%02X.%02X] ", Bus, Dev, Func);
|
||||
DBG(" %s", Label);
|
||||
} else {
|
||||
DBG (" no PciAddr\n");
|
||||
@ -5894,7 +5894,7 @@ GetUserSettings(
|
||||
if (Prop2 && (Prop2->type == kTagTypeString) && Prop2->string) {
|
||||
snprintf (SlotDevice->SlotName, 31, "%s", Prop2->string);
|
||||
} else {
|
||||
AsciiSPrint (SlotDevice->SlotName, 31, "PCI Slot %d", DeviceN);
|
||||
snprintf (SlotDevice->SlotName, 31, "PCI Slot %lld", DeviceN);
|
||||
}
|
||||
|
||||
DBG (" - %s\n", SlotDevice->SlotName);
|
||||
@ -6395,49 +6395,49 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
// s = SearchString(targetString, fileLen, "Running OS Build: Mac OS X ", 27);
|
||||
s = AsciiStrStr(targetString, "Running OS Build: Mac OS X ");
|
||||
if (s[31] == ' ') {
|
||||
AsciiSPrint (Res5, 5, "%c%c.%c\n", s[27], s[28], s[30]);
|
||||
snprintf (Res5, 5, "%c%c.%c\n", s[27], s[28], s[30]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res5), Res5);
|
||||
if (s[38] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[39] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37], s[38]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37], s[38]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
}
|
||||
} else if (s[31] == '.') {
|
||||
AsciiSPrint (Res7, 7, "%c%c.%c.%c\n", s[27], s[28], s[30], s[32]);
|
||||
snprintf (Res7, 7, "%c%c.%c.%c\n", s[27], s[28], s[30], s[32]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
if (s[40] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[41] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
}
|
||||
} else if (s[32] == ' ') {
|
||||
AsciiSPrint (Res6, 6, "%c%c.%c%c\n", s[27], s[28], s[30], s[31]);
|
||||
snprintf (Res6, 6, "%c%c.%c%c\n", s[27], s[28], s[30], s[31]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
if (s[39] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[40] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
} else if (s[41] == ')') {
|
||||
AsciiSPrint (Res8, 8, "%c%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
snprintf (Res8, 8, "%c%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39], s[40]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
}
|
||||
} else if (s[32] == '.') {
|
||||
AsciiSPrint (Res8, 8, "%c%c.%c%c.%c\n", s[27], s[28], s[30], s[31], s[33]);
|
||||
snprintf (Res8, 8, "%c%c.%c%c.%c\n", s[27], s[28], s[30], s[31], s[33]);
|
||||
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
if (s[41] == ')') {
|
||||
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40]);
|
||||
snprintf (Res6, 6, "%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
|
||||
} else if (s[42] == ')') {
|
||||
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41]);
|
||||
snprintf (Res7, 7, "%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
|
||||
} else if (s[43] == ')') {
|
||||
AsciiSPrint (Res8, 8, "%c%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41], s[42]);
|
||||
snprintf (Res8, 8, "%c%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41], s[42]);
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
}
|
||||
}
|
||||
@ -6861,7 +6861,7 @@ GetDevices ()
|
||||
|
||||
default:
|
||||
gfx->Vendor = Unknown;
|
||||
AsciiSPrint (gfx->Model, 64, "pci%04x,%04x", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
|
||||
snprintf (gfx->Model, 64, "pci%04X,%04X", Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
|
||||
LowCase(gfx->Model);
|
||||
gfx->Ports = 1;
|
||||
gfx->Connectors = (1 << NGFX);
|
||||
|
@ -339,10 +339,10 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
AML_CHUNK* metPCT;
|
||||
AML_CHUNK* root = aml_create_node(NULL);
|
||||
aml_add_buffer(root, (UINT8*)&pss_ssdt_header[0], sizeof(pss_ssdt_header)); // SSDT header
|
||||
AsciiSPrint(name, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name1, 31, "%a%4aPSS_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name2, 31, "%a%4aPCT_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name3, 31, "%a%4a_PPC", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name1, 31, "%s%4sPSS_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name2, 31, "%s%4sPCT_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name3, 31, "%s%4s_PPC", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
|
||||
scop = aml_add_scope(root, name);
|
||||
|
||||
@ -406,7 +406,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
// Add CPUs
|
||||
for (decltype(Number) i = 1; i < Number; i++) {
|
||||
AsciiSPrint(name, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
snprintf(name, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
scop = aml_add_scope(root, name);
|
||||
metPSS = aml_add_method(scop, "_PSS", 0);
|
||||
aml_add_return_name(metPSS, name1);
|
||||
@ -488,8 +488,8 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
|
||||
root = aml_create_node(NULL);
|
||||
aml_add_buffer(root, cst_ssdt_header, sizeof(cst_ssdt_header)); // SSDT header
|
||||
AsciiSPrint(name0, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
AsciiSPrint(name1, 31, "%a%4aCST_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name0, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
snprintf(name1, 31, "%s%4sCST_", acpi_cpu_score, acpi_cpu_name[0]);
|
||||
scop = aml_add_scope(root, name0);
|
||||
name = aml_add_name(scop, "CST_");
|
||||
pack = aml_add_package(name);
|
||||
@ -632,7 +632,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
|
||||
// Aliases
|
||||
for (i = 1; i < Number; i++) {
|
||||
AsciiSPrint(name2, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
snprintf(name2, 31, "%s%4s", acpi_cpu_score, acpi_cpu_name[i]);
|
||||
|
||||
scop = aml_add_scope(root, name2);
|
||||
met = aml_add_method(scop, "_CST", 0);
|
||||
|
@ -1322,7 +1322,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AsciiSPrint(pciName, 15, "pci1002,%04x", gSettings.FakeATI >> 16);
|
||||
snprintf(pciName, 15, "pci1002,%04X", gSettings.FakeATI >> 16);
|
||||
LowCase(pciName);
|
||||
val->type = kStr;
|
||||
val->size = 13;
|
||||
@ -1343,25 +1343,25 @@ BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
} else {
|
||||
switch (card->pci_dev->revision) {
|
||||
case 0xC4:
|
||||
AsciiSPrint(ModelName, 35, "AMD Radeon %a", "Pro 550");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "Pro 550");
|
||||
break;
|
||||
case 0xC7:
|
||||
AsciiSPrint(ModelName, 35, "AMD Radeon %a", "RX 480");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 480");
|
||||
break;
|
||||
case 0xC5:
|
||||
case 0xCF:
|
||||
case 0xD7:
|
||||
case 0xE0:
|
||||
AsciiSPrint(ModelName, 35, "AMD Radeon %a", "RX 470");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 470");
|
||||
break;
|
||||
case 0xC2:
|
||||
case 0xC6:
|
||||
case 0xEF:
|
||||
AsciiSPrint(ModelName, 35, "AMD Radeon %a", "RX 570");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 570");
|
||||
break;
|
||||
|
||||
default:
|
||||
AsciiSPrint(ModelName, 35, "AMD Radeon %a", "RX 580");
|
||||
snprintf(ModelName, 35, "AMD Radeon %s", "RX 580");
|
||||
break;
|
||||
}
|
||||
val->size = (UINT32)AsciiStrLen(ModelName);
|
||||
@ -2062,13 +2062,13 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
|
||||
}
|
||||
//
|
||||
name = (__typeof__(name))AllocateZeroPool(24);
|
||||
AsciiSPrint(name, 24, "ATY,%a", card->cfg_name);
|
||||
snprintf(name, 24, "ATY,%s", card->cfg_name);
|
||||
aty_name.type = kStr;
|
||||
aty_name.size = (UINT32)AsciiStrLen(name);
|
||||
aty_name.data = (UINT8 *)name;
|
||||
|
||||
name_parent = (__typeof__(name_parent))AllocateZeroPool(24);
|
||||
AsciiSPrint(name_parent, 24, "ATY,%aParent", card->cfg_name);
|
||||
snprintf(name_parent, 24, "ATY,%sParent", card->cfg_name);
|
||||
aty_nameparent.type = kStr;
|
||||
aty_nameparent.size = (UINT32)AsciiStrLen(name_parent);
|
||||
aty_nameparent.data = (UINT8 *)name_parent;
|
||||
@ -2113,7 +2113,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
|
||||
FakeID = gSettings.FakeATI >> 16;
|
||||
devprop_add_value(card->device, "device-id", (UINT8*)&FakeID, 4);
|
||||
devprop_add_value(card->device, "ATY,DeviceID", (UINT8*)&FakeID, 2);
|
||||
AsciiSPrint(compatible, 64, "pci1002,%04x", FakeID);
|
||||
snprintf(compatible, 64, "pci1002,%04x", FakeID);
|
||||
LowCase(compatible);
|
||||
devprop_add_value(card->device, "@0,compatible", (UINT8*)&compatible[0], 12);
|
||||
FakeID = gSettings.FakeATI & 0xFFFF;
|
||||
|
@ -78,7 +78,7 @@ VOID AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN
|
||||
new_card->VideoRam = VideoRam;
|
||||
new_card->VideoPorts = VideoPorts;
|
||||
new_card->LoadVBios = LoadVBios;
|
||||
AsciiSPrint(new_card->Model, 64, "%a", Model);
|
||||
snprintf(new_card->Model, 64, "%s", Model);
|
||||
InsertTailList (&gCardList, (LIST_ENTRY *)(((UINT8 *)new_card) + OFFSET_OF(CARDLIST, Link)));
|
||||
}
|
||||
}
|
||||
|
@ -285,17 +285,17 @@ CHAR8 *devprop_generate_string(DevPropString *StringBuf)
|
||||
if(!buffer)
|
||||
return NULL;
|
||||
|
||||
AsciiSPrint(buffer, len, "%08X%08X%04X%04X", SwapBytes32(StringBuf->length), StringBuf->WHAT2,
|
||||
snprintf(buffer, len, "%08X%08X%04X%04X", SwapBytes32(StringBuf->length), StringBuf->WHAT2,
|
||||
SwapBytes16(StringBuf->numentries), StringBuf->WHAT3);
|
||||
buffer += 24;
|
||||
|
||||
while(i < StringBuf->numentries) {
|
||||
UINT8 *dataptr = StringBuf->entries[i]->data;
|
||||
AsciiSPrint(buffer, len, "%08X%04X%04X", SwapBytes32(StringBuf->entries[i]->length),
|
||||
snprintf(buffer, len, "%08X%04X%04X", SwapBytes32(StringBuf->entries[i]->length),
|
||||
SwapBytes16(StringBuf->entries[i]->numentries), StringBuf->entries[i]->WHAT2); //FIXME: wrong buffer sizes!
|
||||
|
||||
buffer += 16;
|
||||
AsciiSPrint(buffer, len, "%02X%02X%04X%08X%08X", StringBuf->entries[i]->acpi_dev_path.type,
|
||||
snprintf(buffer, len, "%02X%02X%04X%08X%08X", StringBuf->entries[i]->acpi_dev_path.type,
|
||||
StringBuf->entries[i]->acpi_dev_path.subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->acpi_dev_path.length),
|
||||
SwapBytes32(StringBuf->entries[i]->acpi_dev_path._HID),
|
||||
@ -303,7 +303,7 @@ CHAR8 *devprop_generate_string(DevPropString *StringBuf)
|
||||
|
||||
buffer += 24;
|
||||
for(x = 0; x < StringBuf->entries[i]->num_pci_devpaths; x++) {
|
||||
AsciiSPrint(buffer, len, "%02X%02X%04X%02X%02X", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
snprintf(buffer, len, "%02X%02X%04X%02X%02X", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
StringBuf->entries[i]->pci_dev_path[x].subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->pci_dev_path[x].length),
|
||||
StringBuf->entries[i]->pci_dev_path[x].function,
|
||||
@ -311,13 +311,13 @@ CHAR8 *devprop_generate_string(DevPropString *StringBuf)
|
||||
buffer += 12;
|
||||
}
|
||||
|
||||
AsciiSPrint(buffer, len, "%02X%02X%04X", StringBuf->entries[i]->path_end.type,
|
||||
snprintf(buffer, len, "%02X%02X%04X", StringBuf->entries[i]->path_end.type,
|
||||
StringBuf->entries[i]->path_end.subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->path_end.length));
|
||||
|
||||
buffer += 8;
|
||||
for(x = 0; x < (StringBuf->entries[i]->length) - (24 + (6 * StringBuf->entries[i]->num_pci_devpaths)); x++) {
|
||||
AsciiSPrint(buffer, len, "%02X", *dataptr++);
|
||||
snprintf(buffer, len, "%02X", *dataptr++);
|
||||
buffer += 2;
|
||||
}
|
||||
i++;
|
||||
@ -408,7 +408,7 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev)
|
||||
if (gSettings.FakeLAN) {
|
||||
UINT32 FakeID = gSettings.FakeLAN >> 16;
|
||||
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
|
||||
AsciiSPrint(compatible, 64, "pci%04x,%04x", (gSettings.FakeLAN & 0xFFFF), FakeID);
|
||||
snprintf(compatible, 64, "pci%04X,%04X", (gSettings.FakeLAN & 0xFFFF), FakeID);
|
||||
LowCase(compatible);
|
||||
devprop_add_value(device, "compatible", (UINT8*)&compatible[0], 12);
|
||||
FakeID = gSettings.FakeLAN & 0xFFFF;
|
||||
|
@ -843,7 +843,7 @@ EFI_STATUS InjectKexts(/*IN EFI_MEMORY_DESCRIPTOR *Desc*/ IN UINT32 deviceTreeP,
|
||||
mm = (_DeviceTreeBuffer*) (((UINT8*)prop) + sizeof(DeviceTreeNodeProperty));
|
||||
mm->paddr = (UINT32)KextBase;
|
||||
mm->length = KextEntry->kext.length;
|
||||
AsciiSPrint(prop->Name, 31, "Driver-%x", KextBase);
|
||||
snprintf(prop->Name, 31, "Driver-%X", (UINT32)KextBase);
|
||||
|
||||
drvPtr += sizeof(DeviceTreeNodeProperty) + sizeof(_DeviceTreeBuffer);
|
||||
KextBase = RoundPage(KextBase + KextEntry->kext.length);
|
||||
|
@ -284,16 +284,16 @@ VOID ATIConnectorsPatchInit(LOADER_ENTRY *Entry)
|
||||
//
|
||||
|
||||
// Lion, SnowLeo 10.6.7 2011 MBP
|
||||
AsciiSPrint(ATIKextBundleId[0],
|
||||
snprintf(ATIKextBundleId[0],
|
||||
sizeof(ATIKextBundleId[0]),
|
||||
"com.apple.kext.ATI%aController",
|
||||
Entry->KernelAndKextPatches->KPATIConnectorsController
|
||||
"com.apple.kext.ATI%sController", // when it was AsciiSPrint, %a was used with KPATIConnectorsController which is CHAR16 ??? Result is printing stop at first char <= 255
|
||||
(CHAR8*)Entry->KernelAndKextPatches->KPATIConnectorsController // cast to CHAR8* to not change behavior. Looks like a bug though
|
||||
);
|
||||
// ML
|
||||
AsciiSPrint(ATIKextBundleId[1],
|
||||
snprintf(ATIKextBundleId[1],
|
||||
sizeof(ATIKextBundleId[1]),
|
||||
"com.apple.kext.AMD%aController",
|
||||
Entry->KernelAndKextPatches->KPATIConnectorsController
|
||||
"com.apple.kext.AMD%sController", // when it was AsciiSPrint, %a was used with KPATIConnectorsController which is CHAR16 ??? Result is printing stop at first char <= 255
|
||||
(CHAR8*)Entry->KernelAndKextPatches->KPATIConnectorsController // cast to CHAR8* to not change behavior. Looks like a bug though
|
||||
);
|
||||
|
||||
ATIConnectorsPatchInited = TRUE;
|
||||
|
@ -2073,18 +2073,18 @@ static INT32 devprop_add_nvidia_template(DevPropDevice *device, INTN n_ports)
|
||||
}
|
||||
|
||||
for (pnum = 0; pnum < n_ports; pnum++) {
|
||||
AsciiSPrint(nkey, 24, "@%d,name", pnum);
|
||||
AsciiSPrint(nval, 24, "NVDA,Display-%c", (char)(65+pnum));
|
||||
snprintf(nkey, 24, "@%lld,name", pnum);
|
||||
snprintf(nval, 24, "NVDA,Display-%c", (char)(65+pnum));
|
||||
//DBG("Nvidia: insert [%s : %s]\n", nkey, nval);
|
||||
devprop_add_value(device, nkey, (UINT8*)nval, 14);
|
||||
|
||||
AsciiSPrint(nkey, 24, "@%d,compatible", pnum);
|
||||
snprintf(nkey, 24, "@%lld,compatible", pnum);
|
||||
devprop_add_value(device, nkey, (UINT8*)"NVDA,NVMac", 10);
|
||||
|
||||
AsciiSPrint(nkey, 24, "@%d,device_type", pnum);
|
||||
snprintf(nkey, 24, "@%lld,device_type", pnum);
|
||||
devprop_add_value(device, nkey, (UINT8*)"display", 7);
|
||||
|
||||
AsciiSPrint(nkey, 24, "@%d,display-cfg", pnum);
|
||||
snprintf(nkey, 24, "@%lld,display-cfg", pnum);
|
||||
if (pnum == 0) {
|
||||
devprop_add_value(device, nkey, (gSettings.Dcfg[0] != 0) ? &gSettings.Dcfg[0] : default_dcfg_0, DCFG0_LEN);
|
||||
} else {
|
||||
@ -2472,7 +2472,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
|
||||
if ((devices_number == 1) &&
|
||||
((gSettings.BootDisplay >= 0) && (gSettings.BootDisplay < (INT8)n_ports))) {
|
||||
CHAR8 nkey[24];
|
||||
AsciiSPrint(nkey, 24, "@%d,AAPL,boot-display", gSettings.BootDisplay);
|
||||
snprintf(nkey, 24, "@%d,AAPL,boot-display", gSettings.BootDisplay);
|
||||
devprop_add_value(device, nkey, (UINT8*)&boot_display, 4);
|
||||
DBG("Nvidia: BootDisplay: %d\n", gSettings.BootDisplay);
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
|
||||
while (*i != '.') {
|
||||
i--;
|
||||
}
|
||||
AsciiSPrint (Res1, 9, "%c%c/%c%c/%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
snprintf (Res1, 9, "%c%c/%c%c/%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res1);
|
||||
break;
|
||||
|
||||
@ -621,7 +621,7 @@ VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
|
||||
while (*i != '.') {
|
||||
i--;
|
||||
}
|
||||
AsciiSPrint (Res2, 11, "%c%c/%c%c/20%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
snprintf (Res2, 11, "%c%c/%c%c/20%c%c\n", i[3], i[4], i[5], i[6], i[1], i[2]);
|
||||
AsciiStrCpyS (gSettings.ReleaseDate, 64, Res2);
|
||||
break;
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ VOID PatchTableType4()
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->AssetTag, BrandStr); //like mac
|
||||
// looks to be MicroCode revision
|
||||
if(gCPUStructure.MicroCode > 0){
|
||||
AsciiSPrint(BrandStr, 20, "%X", gCPUStructure.MicroCode);
|
||||
snprintf(BrandStr, 20, "%llX", gCPUStructure.MicroCode); // MicroCode > 0 so %X and %llX do the same
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->SerialNumber, BrandStr);
|
||||
}
|
||||
|
||||
@ -1102,9 +1102,9 @@ VOID PatchTableType11()
|
||||
AsciiStrCatS(OEMString, MAX_OEM_STRING, " Board-ID : ");
|
||||
AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64));
|
||||
#ifdef REVISION_STR
|
||||
AsciiSPrint(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", REVISION_STR);
|
||||
snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", REVISION_STR);
|
||||
#else
|
||||
AsciiSPrint(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover %s\n", gFirmwareRevision);
|
||||
snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover %s\n", gFirmwareRevision);
|
||||
#endif
|
||||
AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
|
||||
|
||||
@ -1354,10 +1354,10 @@ VOID PatchTableType17()
|
||||
newSmbiosTable.Type17->DeviceSet = bank + 1;
|
||||
newSmbiosTable.Type17->MemoryArrayHandle = mHandle16;
|
||||
if (isMacPro) {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
} else {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", bank);
|
||||
AsciiSPrint(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
snprintf(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, (CONST CHAR8*)&bankLocator[0]);
|
||||
}
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, (CONST CHAR8*)&deviceLocator[0]);
|
||||
@ -1602,21 +1602,21 @@ VOID PatchTableType17()
|
||||
newSmbiosTable.Type17->AssetTag = 0;
|
||||
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].Vendor, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
AsciiSPrint(gSettings.MemoryManufacturer, 64, "%a", gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
snprintf(gSettings.MemoryManufacturer, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->Manufacturer = 0;
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].SerialNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
AsciiSPrint(gSettings.MemorySerialNumber, 64, "%a", gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
snprintf(gSettings.MemorySerialNumber, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->SerialNumber = 0;
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].PartNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
AsciiSPrint(gSettings.MemoryPartNumber, 64, "%a", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
snprintf(gSettings.MemoryPartNumber, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
DBG(" partNum=%s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->PartNumber = 0;
|
||||
@ -1645,19 +1645,19 @@ VOID PatchTableType17()
|
||||
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].Vendor, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SPD[SPDIndex].Vendor);
|
||||
AsciiSPrint(gSettings.MemoryManufacturer, 64, "%a", gRAM.SPD[SPDIndex].Vendor);
|
||||
snprintf(gSettings.MemoryManufacturer, 64, "%s", gRAM.SPD[SPDIndex].Vendor);
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].SerialNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SPD[SPDIndex].SerialNo);
|
||||
AsciiSPrint(gSettings.MemorySerialNumber, 64, "%a", gRAM.SPD[SPDIndex].SerialNo);
|
||||
snprintf(gSettings.MemorySerialNumber, 64, "%s", gRAM.SPD[SPDIndex].SerialNo);
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].PartNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SPD[SPDIndex].PartNo);
|
||||
AsciiSPrint(gSettings.MemoryPartNumber, 64, "%a", gRAM.SPD[SPDIndex].PartNo);
|
||||
snprintf(gSettings.MemoryPartNumber, 64, "%s", gRAM.SPD[SPDIndex].PartNo);
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown);
|
||||
}
|
||||
@ -1686,7 +1686,7 @@ VOID PatchTableType17()
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
}
|
||||
|
||||
AsciiSPrint(gSettings.MemorySpeed, 64, "%d", newSmbiosTable.Type17->Speed);
|
||||
snprintf(gSettings.MemorySpeed, 64, "%d", newSmbiosTable.Type17->Speed);
|
||||
|
||||
// Assume DDR3 unless explicitly set to DDR2/DDR/DDR4
|
||||
if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) &&
|
||||
@ -1697,12 +1697,11 @@ VOID PatchTableType17()
|
||||
|
||||
//now I want to update deviceLocator and bankLocator
|
||||
if (isMacPro) {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
// AsciiSPrint(bankLocator, 10, "");
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
bankLocator[0] = 0;
|
||||
} else {
|
||||
AsciiSPrint(deviceLocator, 10, "DIMM%d", bank);
|
||||
AsciiSPrint(bankLocator, 10, "BANK %d", Index % channels);
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
snprintf(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
}
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, (CONST CHAR8*)&deviceLocator[0]);
|
||||
if (isMacPro) {
|
||||
|
@ -542,12 +542,12 @@ CHAR8* getDDRSerial(UINT8* spd)
|
||||
CHAR8* asciiSerial; //[16];
|
||||
asciiSerial = (__typeof__(asciiSerial))AllocatePool(17);
|
||||
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR4) { // DDR4
|
||||
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(325) /*& 0x7*/, SLST(325), SMST(326), SLST(326), SMST(327), SLST(327), SMST(328), SLST(328));
|
||||
snprintf(asciiSerial, 17, "%02X%02X%02X%02X%02X%02X%02X%02X", SMST(325) /*& 0x7*/, SLST(325), SMST(326), SLST(326), SMST(327), SLST(327), SMST(328), SLST(328));
|
||||
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { // DDR3
|
||||
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
|
||||
snprintf(asciiSerial, 17, "%02X%02X%02X%02X%02X%02X%02X%02X", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
|
||||
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 ||
|
||||
spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) { // DDR2 or DDR
|
||||
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
|
||||
snprintf(asciiSerial, 17, "%02X%02X%02X%02X%02X%02X%02X%02X", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
|
||||
} else {
|
||||
AsciiStrCpyS(asciiSerial, 17, "0000000000000000");
|
||||
}
|
||||
|
@ -15,8 +15,11 @@
|
||||
#include "strlen_test.h"
|
||||
#include "printf_lite-test.h"
|
||||
#include "LoadOptions_test.h"
|
||||
//#include "poolprint-test.h"
|
||||
//#include "printlib-test.h"
|
||||
|
||||
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
|
||||
#include "poolprint-test.h"
|
||||
#include "printlib-test.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* On macOS
|
||||
@ -37,16 +40,16 @@ bool all_tests()
|
||||
// all_ok = false;
|
||||
// }
|
||||
#if defined(CLOVER_BUILD)
|
||||
// ret = printlib_tests();
|
||||
// if ( ret != 0 ) {
|
||||
// DebugLog(2, "printlib_tests() failed at test %d\n", ret);
|
||||
// all_ok = false;
|
||||
// }
|
||||
// ret = poolprint_tests();
|
||||
// if ( ret != 0 ) {
|
||||
// DebugLog(2, "poolprint_tests() failed at test %d\n", ret);
|
||||
// all_ok = false;
|
||||
// }
|
||||
ret = printlib_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "printlib_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = poolprint_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "poolprint_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifndef _MSC_VER
|
||||
@ -117,15 +120,13 @@ bool all_tests()
|
||||
}
|
||||
|
||||
#if defined(JIEF_DEBUG)
|
||||
if ( !all_ok ) {
|
||||
printf("All tests are NOT ok\n");
|
||||
}else{
|
||||
if ( all_ok ) {
|
||||
printf("All tests are ok\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CLOVER_BUILD) && defined(JIEF_DEBUG)
|
||||
if ( !all_ok ) {
|
||||
if ( all_ok ) {
|
||||
// PauseForKey(L"press");
|
||||
}else{
|
||||
PauseForKey(L"press");
|
||||
|
@ -175,6 +175,12 @@ int printf_lite_tests(void)
|
||||
#endif
|
||||
|
||||
|
||||
Test1arg(F("|80123456|"), F("|%X|"), (int)0xFFFFFFFF80123456);
|
||||
Test1arg(F("|FFFFFFFF80123456|"), F("|%lX|"), 0xFFFFFFFF80123456);
|
||||
|
||||
Test1arg(F("Āࠀ𐀀🧊Выход'utf8'из"), F("Āࠀ𐀀🧊Выход'%s'из"), "utf8");
|
||||
|
||||
|
||||
// char buf[256];
|
||||
// snprintf(buf, sizeof(buf), "test %s", "ascii");
|
||||
|
||||
@ -197,6 +203,25 @@ int printf_lite_tests(void)
|
||||
Test1arg(F("Āࠀ𐀀🧊Выхо'ыход'из"), F("Āࠀ𐀀🧊Выхо'%s'из"), "ыход");
|
||||
Test1arg(F("Āࠀ𐀀🧊Выхо'ыход'из"), F("Āࠀ𐀀🧊Выхо'%ls'из"), L"ыход");
|
||||
|
||||
Test1arg(F("'u'"), F("'%s'"), (char*)L"utf16-string");
|
||||
|
||||
|
||||
// Check %s with width specifier
|
||||
Test1arg(F("|a|"), F("|%4s|"), "a");
|
||||
Test1arg(F("|aa|"), F("|%4s|"), "aa");
|
||||
Test1arg(F("|aaa|"), F("|%4s|"), "aaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4s|"), "aaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4s|"), "aaaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4s|"), "aaaaaa");
|
||||
|
||||
// Check %ls with width specifier
|
||||
Test1arg(F("|a|"), F("|%4ls|"), L"a");
|
||||
Test1arg(F("|aa|"), F("|%4ls|"), L"aa");
|
||||
Test1arg(F("|aaa|"), F("|%4ls|"), L"aaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4ls|"), L"aaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4ls|"), L"aaaaa");
|
||||
Test1arg(F("|aaaa|"), F("|%4ls|"), L"aaaaaa");
|
||||
|
||||
|
||||
// These must always works. It also test that integer type are well defined
|
||||
Test1arg(F("sizeof(uint8_t)=1"), F("sizeof(uint8_t)=%zu"), sizeof(uint8_t));
|
||||
@ -258,12 +283,39 @@ int printf_lite_tests(void)
|
||||
Test1arg(F("| 12|"), F("|%5d|"), 12);
|
||||
Test1arg(F("| 12|"), F("|%5u|"), 12);
|
||||
Test1arg(F("| c|"), F("|%5x|"), 12);
|
||||
Test1arg(F("| C|"), F("|%5X|"), 12);
|
||||
|
||||
// test pad char but no width (no effect)
|
||||
Test1arg(F("|c|"), F("|%0x|"), 12);
|
||||
Test1arg(F("|C|"), F("|%0X|"), 12);
|
||||
|
||||
// test with specifier, 0 as pad char
|
||||
Test1arg(F("|00012|"), F("|%05d|"), 12);
|
||||
Test1arg(F("|00012|"), F("|%05u|"), 12);
|
||||
Test1arg(F("|0000c|"), F("|%05x|"), 12);
|
||||
|
||||
|
||||
Test1arg(F("|0A23|"), F("|%04X|"), 0xa23);
|
||||
Test1arg(F("|A234|"), F("|%04X|"), 0xa234);
|
||||
Test1arg(F("|A2345|"), F("|%04X|"), 0xa2345);
|
||||
Test1arg(F("|0a23|"), F("|%04x|"), 0xA23);
|
||||
Test1arg(F("|a234|"), F("|%04x|"), 0xA234);
|
||||
Test1arg(F("|a2345|"), F("|%04x|"), 0xA2345);
|
||||
Test1arg(F("|01|"), F("|%02d|"), 1);
|
||||
Test1arg(F("|12|"), F("|%02d|"), 12);
|
||||
Test1arg(F("|120|"), F("|%02d|"), 120);
|
||||
|
||||
|
||||
Test1arg(F("|0|"), F("|%01d|"), 0);
|
||||
Test1arg(F("|1|"), F("|%01d|"), 1);
|
||||
Test1arg(F("|100|"), F("|%01d|"), 100);
|
||||
Test1arg(F("|10000|"), F("|%01d|"), 10000);
|
||||
Test1arg(F("|-1|"), F("|%01d|"), -1);
|
||||
Test1arg(F("|-100|"), F("|%01d|"), -100);
|
||||
Test1arg(F("|-10000|"), F("|%01d|"), -10000);
|
||||
|
||||
|
||||
|
||||
// Test1arg float format
|
||||
Test1arg(F("|0.000000|"), F("|%0f|"), 0.0f);
|
||||
Test1arg(F("|0.000000|"), F("|%1f|"), 0.0f);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <Platform.h>
|
||||
#include <limits.h>
|
||||
#include "unicode_conversions.h"
|
||||
#include "../cpp_foundation/unicode_conversions.h"
|
||||
#include <printlib-test-cpp_conf.h>
|
||||
#include "printlib-test.h"
|
||||
|
||||
@ -109,36 +109,36 @@ static int testWPrintf(const char* label, const wchar_t* expectResult, int expe
|
||||
#define Test1arg(expectResult,format,c) \
|
||||
{ \
|
||||
char label[1024]; \
|
||||
snprintf(label, sizeof(label), F("Test sprintf(%s, %s)"), F(#format), F(#c)); \
|
||||
snprintf(label, sizeof(label), F("Test AsciiVSPrint(%s, %s)"), F(#format), F(#c)); \
|
||||
testPrintf(label,expectResult,(int)strlen(expectResult),format,c); \
|
||||
snprintf(label, sizeof(label), F("Test swprintf(%s, %s)"), F(#format), F(#c)); \
|
||||
snprintf(label, sizeof(label), F("Test UnicodeVSPrint(%s, %s)"), F(#format), F(#c)); \
|
||||
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c); \
|
||||
}
|
||||
|
||||
#define Test2arg(expectResult,format,c,d) \
|
||||
{ \
|
||||
char label[1024]; \
|
||||
snprintf(label, sizeof(label), F("Test sprintf(%s, %s, %s)"), F(#format), F(#c), F(#d)); \
|
||||
snprintf(label, sizeof(label), F("Test AsciiVSPrint(%s, %s, %s)"), F(#format), F(#c), F(#d)); \
|
||||
testPrintf(label,expectResult,(int)strlen(expectResult),format,c,d); \
|
||||
snprintf(label, sizeof(label), F("Test swprintf(%s, %s, %s)"), F(#format), F(#c), F(#d)); \
|
||||
snprintf(label, sizeof(label), F("Test UnicodeVSPrint(%s, %s, %s)"), F(#format), F(#c), F(#d)); \
|
||||
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c,d); \
|
||||
}
|
||||
|
||||
#define Test5arg(expectResult,format,c,d,e,f,g) \
|
||||
{ \
|
||||
char label[1024]; \
|
||||
snprintf(label, sizeof(label), F("Test sprintf(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
snprintf(label, sizeof(label), F("Test AsciiVSPrint(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
testPrintf(label,expectResult,(int)strlen(expectResult),format,c,d,e,f,g); \
|
||||
snprintf(label, sizeof(label), F("Test swprintf(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
snprintf(label, sizeof(label), F("Test UnicodeVSPrint(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c,d,e,f,g); \
|
||||
}
|
||||
|
||||
#define TestLen5arg(expectResult,expectedRet,format,c,d,e,f,g) \
|
||||
{ \
|
||||
char label[1024]; \
|
||||
snprintf(label, sizeof(label), F("Test sprintf(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
snprintf(label, sizeof(label), F("Test AsciiVSPrint(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
testPrintf(label,expectResult,expectedRet,format,c,d,e,f,g); \
|
||||
snprintf(label, sizeof(label), F("Test swprintf(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
snprintf(label, sizeof(label), F("Test UnicodeVSPrint(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
|
||||
testWPrintf(label,L##expectResult,expectedRet,L##format,c,d,e,f,g); \
|
||||
}
|
||||
|
||||
@ -228,6 +228,14 @@ int printlib_tests(void)
|
||||
Test1arg(F("|ABFE|"), F("|%x|"), 0xABFE); // %x for PrintLib is %X for printf
|
||||
Test1arg(F("|ABFED|"), F("|%x|"), 0xABFED); // %x for PrintLib is %X for printf
|
||||
Test1arg(F("|ABF|"), F("|%X|"), 0xABF);
|
||||
Test1arg(F("|FFFFFFF6|"), F("|%x|"), -10);
|
||||
Test1arg(F("|FFFFFFF6|"), F("|%X|"), -10);
|
||||
Test1arg(F("|FFFFFFF6|"), F("|%2X|"), -10);
|
||||
Test1arg(F("|FFFFFFF6|"), F("|%0X|"), -10);
|
||||
Test1arg(F("| FFFFFFF6|"), F("|%20x|"), -10);
|
||||
Test1arg(F("|FFFFFFF6|"), F("|%lx|"), -10);
|
||||
Test1arg(F("|FFFFFFFFFFFFFFF6|"), F("|%lX|"), -10L);
|
||||
Test1arg(F("|0000FFFFFFFFFFFFFFF6|"), F("|%20lX|"), -10L);
|
||||
|
||||
// test with specifier, space as pad char
|
||||
Test1arg(F("| 0|"), F("|%5d|"), 0);
|
||||
@ -241,6 +249,9 @@ int printlib_tests(void)
|
||||
Test1arg(F("|ABFE|"), F("|%2x|"), 0xABFE); // %x for PrintLib is %X for printf
|
||||
Test1arg(F("|ABFE|"), F("|%2X|"), 0xABFE);
|
||||
|
||||
Test1arg(F("|12345|"), F("|%2X|"), 0x12345);
|
||||
Test1arg(F("|12345|"), F("|%4X|"), 0x12345);
|
||||
|
||||
// test test with specifier, space as pad char
|
||||
Test1arg(F("| 12|"), F("|%5d|"), 12);
|
||||
Test1arg(F("| 12|"), F("|%5u|"), 12);
|
||||
@ -252,6 +263,14 @@ int printlib_tests(void)
|
||||
Test1arg(F("|00012|"), F("|%05u|"), 12);
|
||||
Test1arg(F("|0000C|"), F("|%05x|"), 12); // %x for PrintLib is %X for printf
|
||||
Test1arg(F("|0000C|"), F("|%05X|"), 12);
|
||||
|
||||
Test1arg(F("|80123456|"), F("|%03X|"), 0xFFFFFFFF80123456);
|
||||
Test1arg(F("|FFFFFFFF80123456|"), F("|%03lX|"), 0xFFFFFFFF80123456);
|
||||
Test1arg(F("|80123456|"), F("|%05X|"), 0xFFFFFFFF80123456);
|
||||
Test1arg(F("|80123456|"), F("|%07X|"), 0xFFFFFFFF80123456);
|
||||
Test1arg(F("|080123456|"), F("|%09X|"), 0xFFFFFFFF80123456);
|
||||
Test1arg(F("|00000000000080123456|"), F("|%020X|"), 0xFFFFFFFF80123456);
|
||||
Test1arg(F("|0000FFFFFFFF80123456|"), F("|%020lX|"), 0xFFFFFFFF80123456);
|
||||
|
||||
// test limits
|
||||
int16_t i;
|
||||
|
@ -2581,7 +2581,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
|
||||
}
|
||||
if (/*MenuExit == MENU_EXIT_ENTER &&*/ MainChosenEntry->getLOADER_ENTRY()) {
|
||||
if (MainChosenEntry->getLOADER_ENTRY()->LoadOptions.notEmpty()) {
|
||||
AsciiSPrint(gSettings.BootArgs, 255, "%a", MainChosenEntry->getLOADER_ENTRY()->LoadOptions.c_str());
|
||||
snprintf(gSettings.BootArgs, 255, "%s", MainChosenEntry->getLOADER_ENTRY()->LoadOptions.c_str());
|
||||
} else {
|
||||
ZeroMem(&gSettings.BootArgs, 255);
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONS
|
||||
// I = (INTN)X;
|
||||
// D = (float)I;
|
||||
// Fract = fabsf((X - D) * 1000000.0f);
|
||||
// AsciiSPrint(S, N, "%D.%06D", I, (INTN)Fract);
|
||||
// snprintf(S, N, "%D.%06D", I, (INTN)Fract);
|
||||
//}
|
||||
#endif
|
||||
//
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "FloatLib.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_SVG 1
|
||||
#define DEBUG_SVG 0
|
||||
#else
|
||||
#define DEBUG_SVG DEBUG_ALL
|
||||
#endif
|
||||
@ -2872,9 +2872,12 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
|
||||
NSVGparser *p1 = NULL;
|
||||
EFI_STATUS Status;
|
||||
DBG("required font %s not found, try to load external\n", text->fontFace->fontFamily);
|
||||
Status = egLoadFile(ThemeX.ThemeDir, PoolPrint(L"%s.svg", text->fontFace->fontFamily), &FileData, &FileDataLength);
|
||||
|
||||
DBG("font %s loaded status=%s\n", text->fontFace->fontFamily, strerror(Status));
|
||||
// CONST CHAR16 *FontFileName = PoolPrint(L"%a.svg", text->fontFace->fontFamily);
|
||||
XStringW FontFileName = XStringW().takeValueFrom(text->fontFace->fontFamily) + L".svg"_XSW;
|
||||
DBG(" file name =%ls\n", FontFileName.wc_str());
|
||||
Status = egLoadFile(ThemeX.ThemeDir, FontFileName.wc_str(), &FileData, &FileDataLength);
|
||||
// FreePool(FontFileName);
|
||||
DBG(" font %s loaded status=%lld, %s\n", text->fontFace->fontFamily, Status, strerror(Status));
|
||||
if (!EFI_ERROR(Status)) {
|
||||
p1 = nsvgParse((CHAR8*)FileData, 72, 1.0f); //later we will free parser p1
|
||||
if (!p1) {
|
||||
@ -4293,7 +4296,7 @@ void nsvg__imageBounds(NSVGparser* p, float* bounds)
|
||||
clipPath = clipPath->next;
|
||||
}
|
||||
count += nsvg__shapesBound(image->shapes, bounds);
|
||||
DBG("found shapes=%d\n", count);
|
||||
// DBG("found shapes=%d\n", count);
|
||||
if (count == 0) {
|
||||
bounds[0] = bounds[1] = 0.0f;
|
||||
bounds[2] = bounds[3] = 1.0f;
|
||||
|
@ -248,7 +248,7 @@ VOID FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount++].BValue = gSettings.InjectNVidia;
|
||||
InputItems[InputItemsCount].ItemType = ASString; //22+6i
|
||||
for (j=0; j<8; j++) {
|
||||
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02x", gSettings.Dcfg[j]);
|
||||
snprintf((CHAR8*)&tmp[2*j], 3, "%02X", gSettings.Dcfg[j]);
|
||||
}
|
||||
if (New) {
|
||||
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(40);
|
||||
@ -281,7 +281,7 @@ VOID FillInputs(BOOLEAN New)
|
||||
if (gGraphics[i].Vendor == Nvidia) {
|
||||
InputItems[InputItemsCount].ItemType = ASString; //24+6i
|
||||
for (j=0; j<20; j++) {
|
||||
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02X", gSettings.NVCAP[j]);
|
||||
snprintf((CHAR8*)&tmp[2*j], 3, "%02X", gSettings.NVCAP[j]);
|
||||
}
|
||||
if (New) {
|
||||
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(84);
|
||||
@ -650,7 +650,7 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
} while (*(++ch));
|
||||
|
||||
AsciiSPrint(gSettings.BootArgs, 255, "%s ", InputItems[i].SValue);
|
||||
snprintf(gSettings.BootArgs, 255, "%ls ", InputItems[i].SValue);
|
||||
}
|
||||
i++; //1
|
||||
if (InputItems[i].Valid) {
|
||||
|
Loading…
Reference in New Issue
Block a user