From 6d54a4c0b64f2dfb00b2085453422a0133c9a4b6 Mon Sep 17 00:00:00 2001 From: Jief L Date: Fri, 10 Apr 2020 15:35:25 +0300 Subject: [PATCH] Get rid of AsciiPrintf used with %d --- rEFIt_UEFI/Platform/Settings.cpp | 2 +- rEFIt_UEFI/Platform/nvidia.cpp | 10 +++++----- rEFIt_UEFI/Platform/smbios.cpp | 12 ++++++------ rEFIt_UEFI/libeg/FloatLib.cpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 5cca32839..cdd78c463 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -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); diff --git a/rEFIt_UEFI/Platform/nvidia.cpp b/rEFIt_UEFI/Platform/nvidia.cpp index dd95b868a..1f04a1e64 100644 --- a/rEFIt_UEFI/Platform/nvidia.cpp +++ b/rEFIt_UEFI/Platform/nvidia.cpp @@ -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); + 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); } diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index 827e7dfe3..d1ec237d2 100644 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -1348,9 +1348,9 @@ 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); + snprintf(deviceLocator, 10, "DIMM%d", bank); AsciiSPrint(bankLocator, 10, "BANK %llu", Index % channels); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, (CONST CHAR8*)&bankLocator[0]); } @@ -1680,7 +1680,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) && @@ -1691,12 +1691,12 @@ VOID PatchTableType17() //now I want to update deviceLocator and bankLocator if (isMacPro) { - AsciiSPrint(deviceLocator, 10, "DIMM%d", gRAMCount + 1); + snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1); // AsciiSPrint(bankLocator, 10, ""); 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) { diff --git a/rEFIt_UEFI/libeg/FloatLib.cpp b/rEFIt_UEFI/libeg/FloatLib.cpp index 13b2457af..ff9e4a9ef 100644 --- a/rEFIt_UEFI/libeg/FloatLib.cpp +++ b/rEFIt_UEFI/libeg/FloatLib.cpp @@ -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 //