From 3ed1a89bcc4f37d50d24742b7a7411454f904be4 Mon Sep 17 00:00:00 2001 From: jief Date: Mon, 13 Apr 2020 10:25:42 +0300 Subject: [PATCH] Swicth %X to %x in snprintf and get rid of LowCase. --- rEFIt_UEFI/Platform/FixBiosDsdt.cpp | 4 +--- rEFIt_UEFI/Platform/Settings.cpp | 3 +-- rEFIt_UEFI/Platform/ati.cpp | 4 +--- rEFIt_UEFI/Platform/device_inject.cpp | 3 +-- rEFIt_UEFI/cpp_unit_test/printf_lite-test.cpp | 1 + rEFIt_UEFI/refit/IO.cpp | 18 +++++++++--------- rEFIt_UEFI/refit/IO.h | 2 +- 7 files changed, 15 insertions(+), 20 deletions(-) diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp index 2be789d3f..c750ac487 100755 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp @@ -2961,8 +2961,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card) if (gSettings.FakeLAN) { FakeID = gSettings.FakeLAN >> 16; FakeVen = gSettings.FakeLAN & 0xFFFF; - snprintf(NameCard, 32, "pci%04X,%04X", FakeVen, FakeID); - LowCase(NameCard); + snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID); Netmodel[card] = get_net_model((FakeVen << 16) + FakeID); } @@ -3165,7 +3164,6 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len) FakeID = gSettings.FakeWIFI >> 16; FakeVen = gSettings.FakeWIFI & 0xFFFF; snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID); - LowCase(NameCard); } PCIADR = GetPciDevice(dsdt, len); diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 6c6e8bef7..815418deb 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -6869,8 +6869,7 @@ GetDevices () default: gfx->Vendor = Unknown; - snprintf (gfx->Model, 64, "pci%04X,%04X", Pci.Hdr.VendorId, Pci.Hdr.DeviceId); - LowCase(gfx->Model); + snprintf (gfx->Model, 64, "pci%04x,%04x", Pci.Hdr.VendorId, Pci.Hdr.DeviceId); gfx->Ports = 1; gfx->Connectors = (1 << NGFX); gfx->ConnChanged = FALSE; diff --git a/rEFIt_UEFI/Platform/ati.cpp b/rEFIt_UEFI/Platform/ati.cpp index d416b421c..8edde532b 100644 --- a/rEFIt_UEFI/Platform/ati.cpp +++ b/rEFIt_UEFI/Platform/ati.cpp @@ -1322,8 +1322,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier) return FALSE; } - snprintf(pciName, 15, "pci1002,%04X", gSettings.FakeATI >> 16); - LowCase(pciName); + snprintf(pciName, 15, "pci1002,%04x", gSettings.FakeATI >> 16); val->type = kStr; val->size = 13; val->data = (UINT8 *)pciName; @@ -2114,7 +2113,6 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev) devprop_add_value(card->device, "device-id", (UINT8*)&FakeID, 4); devprop_add_value(card->device, "ATY,DeviceID", (UINT8*)&FakeID, 2); snprintf(compatible, 64, "pci1002,%04x", FakeID); - LowCase(compatible); devprop_add_value(card->device, "@0,compatible", (UINT8*)&compatible[0], 12); FakeID = gSettings.FakeATI & 0xFFFF; devprop_add_value(card->device, "vendor-id", (UINT8*)&FakeID, 4); diff --git a/rEFIt_UEFI/Platform/device_inject.cpp b/rEFIt_UEFI/Platform/device_inject.cpp index da1395ee6..1818179f0 100644 --- a/rEFIt_UEFI/Platform/device_inject.cpp +++ b/rEFIt_UEFI/Platform/device_inject.cpp @@ -408,8 +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); - snprintf(compatible, 64, "pci%04X,%04X", (gSettings.FakeLAN & 0xFFFF), FakeID); - LowCase(compatible); + snprintf(compatible, 64, "pci%04x,%04x", (gSettings.FakeLAN & 0xFFFF), FakeID); devprop_add_value(device, "compatible", (UINT8*)&compatible[0], 12); FakeID = gSettings.FakeLAN & 0xFFFF; devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4); diff --git a/rEFIt_UEFI/cpp_unit_test/printf_lite-test.cpp b/rEFIt_UEFI/cpp_unit_test/printf_lite-test.cpp index 002108b11..91a7c1840 100644 --- a/rEFIt_UEFI/cpp_unit_test/printf_lite-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/printf_lite-test.cpp @@ -293,6 +293,7 @@ int printf_lite_tests(void) Test1arg(F("|00012|"), F("|%05d|"), 12); Test1arg(F("|00012|"), F("|%05u|"), 12); Test1arg(F("|0000c|"), F("|%05x|"), 12); + Test1arg(F("|0000C|"), F("|%05X|"), 12); Test1arg(F("|0A|"), F("|%02X|"), (uint8_t)0xa); #define SMST(a) ((UINT8)((a & 0xf0) >> 4)) #define SLST(a) ((UINT8)(a & 0x0f)) diff --git a/rEFIt_UEFI/refit/IO.cpp b/rEFIt_UEFI/refit/IO.cpp index bcf7522de..51749a73e 100644 --- a/rEFIt_UEFI/refit/IO.cpp +++ b/rEFIt_UEFI/refit/IO.cpp @@ -1839,15 +1839,15 @@ LibGetPageBreak ( } */ // -VOID LowCase (IN OUT CHAR8 *Str) -{ - while (*Str) { - if (IS_UPPER(*Str)) { - *Str |= 0x20; - } - Str++; - } -} +//VOID LowCase (IN OUT CHAR8 *Str) +//{ +// while (*Str) { +// if (IS_UPPER(*Str)) { +// *Str |= 0x20; +// } +// Str++; +// } +//} UINT8 hexstrtouint8 (CHAR8* buf) diff --git a/rEFIt_UEFI/refit/IO.h b/rEFIt_UEFI/refit/IO.h index a565ea239..b08c3b119 100644 --- a/rEFIt_UEFI/refit/IO.h +++ b/rEFIt_UEFI/refit/IO.h @@ -289,7 +289,7 @@ WaitFor2EventWithTsc ( EFI_STATUS WaitForInputEventPoll(REFIT_MENU_SCREEN *Screen, UINTN TimeoutDefault); -VOID LowCase (IN OUT CHAR8 *Str); +//VOID LowCase (IN OUT CHAR8 *Str); UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len); BOOLEAN IsHexDigit (CHAR8 c); UINT8 hexstrtouint8 (CHAR8* buf); //one or two hex letters to one byte