mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-25 16:37:42 +01:00
Some more checked conversion to snprintf.
This commit is contained in:
parent
79c36b193d
commit
109cbc1cda
@ -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");
|
||||
@ -4092,7 +4092,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
AsciiSPrint(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]);
|
||||
|
@ -914,7 +914,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, "%X", gCPUStructure.MicroCode);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->SerialNumber, BrandStr);
|
||||
}
|
||||
|
||||
@ -1351,7 +1351,7 @@ VOID PatchTableType17()
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
} else {
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
AsciiSPrint(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
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]);
|
||||
@ -1692,7 +1692,6 @@ VOID PatchTableType17()
|
||||
//now I want to update deviceLocator and bankLocator
|
||||
if (isMacPro) {
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
// AsciiSPrint(bankLocator, 10, "");
|
||||
bankLocator[0] = 0;
|
||||
} else {
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
|
@ -203,6 +203,9 @@ 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");
|
||||
@ -280,6 +283,11 @@ 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);
|
||||
@ -297,6 +305,17 @@ int printf_lite_tests(void)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user