Swicth %X to %x in snprintf and get rid of LowCase.

This commit is contained in:
jief 2020-04-13 10:25:42 +03:00
parent fd2433e9e2
commit 3ed1a89bcc
7 changed files with 15 additions and 20 deletions

View File

@ -2961,8 +2961,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
if (gSettings.FakeLAN) { if (gSettings.FakeLAN) {
FakeID = gSettings.FakeLAN >> 16; FakeID = gSettings.FakeLAN >> 16;
FakeVen = gSettings.FakeLAN & 0xFFFF; FakeVen = gSettings.FakeLAN & 0xFFFF;
snprintf(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); Netmodel[card] = get_net_model((FakeVen << 16) + FakeID);
} }
@ -3165,7 +3164,6 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
FakeID = gSettings.FakeWIFI >> 16; FakeID = gSettings.FakeWIFI >> 16;
FakeVen = gSettings.FakeWIFI & 0xFFFF; FakeVen = gSettings.FakeWIFI & 0xFFFF;
snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID); snprintf(NameCard, 32, "pci%04x,%04x", FakeVen, FakeID);
LowCase(NameCard);
} }
PCIADR = GetPciDevice(dsdt, len); PCIADR = GetPciDevice(dsdt, len);

View File

@ -6869,8 +6869,7 @@ GetDevices ()
default: default:
gfx->Vendor = Unknown; gfx->Vendor = Unknown;
snprintf (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->Ports = 1;
gfx->Connectors = (1 << NGFX); gfx->Connectors = (1 << NGFX);
gfx->ConnChanged = FALSE; gfx->ConnChanged = FALSE;

View File

@ -1322,8 +1322,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
return FALSE; return FALSE;
} }
snprintf(pciName, 15, "pci1002,%04X", gSettings.FakeATI >> 16); snprintf(pciName, 15, "pci1002,%04x", gSettings.FakeATI >> 16);
LowCase(pciName);
val->type = kStr; val->type = kStr;
val->size = 13; val->size = 13;
val->data = (UINT8 *)pciName; 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, "device-id", (UINT8*)&FakeID, 4);
devprop_add_value(card->device, "ATY,DeviceID", (UINT8*)&FakeID, 2); devprop_add_value(card->device, "ATY,DeviceID", (UINT8*)&FakeID, 2);
snprintf(compatible, 64, "pci1002,%04x", FakeID); snprintf(compatible, 64, "pci1002,%04x", FakeID);
LowCase(compatible);
devprop_add_value(card->device, "@0,compatible", (UINT8*)&compatible[0], 12); devprop_add_value(card->device, "@0,compatible", (UINT8*)&compatible[0], 12);
FakeID = gSettings.FakeATI & 0xFFFF; FakeID = gSettings.FakeATI & 0xFFFF;
devprop_add_value(card->device, "vendor-id", (UINT8*)&FakeID, 4); devprop_add_value(card->device, "vendor-id", (UINT8*)&FakeID, 4);

View File

@ -408,8 +408,7 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev)
if (gSettings.FakeLAN) { if (gSettings.FakeLAN) {
UINT32 FakeID = gSettings.FakeLAN >> 16; UINT32 FakeID = gSettings.FakeLAN >> 16;
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4); devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
snprintf(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); devprop_add_value(device, "compatible", (UINT8*)&compatible[0], 12);
FakeID = gSettings.FakeLAN & 0xFFFF; FakeID = gSettings.FakeLAN & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4); devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);

View File

@ -293,6 +293,7 @@ int printf_lite_tests(void)
Test1arg(F("|00012|"), F("|%05d|"), 12); Test1arg(F("|00012|"), F("|%05d|"), 12);
Test1arg(F("|00012|"), F("|%05u|"), 12); Test1arg(F("|00012|"), F("|%05u|"), 12);
Test1arg(F("|0000c|"), F("|%05x|"), 12); Test1arg(F("|0000c|"), F("|%05x|"), 12);
Test1arg(F("|0000C|"), F("|%05X|"), 12);
Test1arg(F("|0A|"), F("|%02X|"), (uint8_t)0xa); Test1arg(F("|0A|"), F("|%02X|"), (uint8_t)0xa);
#define SMST(a) ((UINT8)((a & 0xf0) >> 4)) #define SMST(a) ((UINT8)((a & 0xf0) >> 4))
#define SLST(a) ((UINT8)(a & 0x0f)) #define SLST(a) ((UINT8)(a & 0x0f))

View File

@ -1839,15 +1839,15 @@ LibGetPageBreak (
} }
*/ */
// //
VOID LowCase (IN OUT CHAR8 *Str) //VOID LowCase (IN OUT CHAR8 *Str)
{ //{
while (*Str) { // while (*Str) {
if (IS_UPPER(*Str)) { // if (IS_UPPER(*Str)) {
*Str |= 0x20; // *Str |= 0x20;
} // }
Str++; // Str++;
} // }
} //}
UINT8 hexstrtouint8 (CHAR8* buf) UINT8 hexstrtouint8 (CHAR8* buf)

View File

@ -289,7 +289,7 @@ WaitFor2EventWithTsc (
EFI_STATUS EFI_STATUS
WaitForInputEventPoll(REFIT_MENU_SCREEN *Screen, UINTN TimeoutDefault); 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); UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
BOOLEAN IsHexDigit (CHAR8 c); BOOLEAN IsHexDigit (CHAR8 c);
UINT8 hexstrtouint8 (CHAR8* buf); //one or two hex letters to one byte UINT8 hexstrtouint8 (CHAR8* buf); //one or two hex letters to one byte