Remove outdated dead code (AddLoadOption and RemoveLoadOption).

This commit is contained in:
jief666 2021-10-20 10:55:05 +02:00
parent 710b2dcee5
commit be9b4c2d7f
4 changed files with 0 additions and 212 deletions

View File

@ -12,22 +12,6 @@ int BootOptions_tests()
// printf("XStringW_tests -> Enter\n");
#endif
// {
// XString LoadOptions;
//
// LoadOptions = AddLoadOption(LoadOptions, "opt1"_XS8);
// LoadOptions = AddLoadOption(LoadOptions, "opt2"_XS8);
// LoadOptions = AddLoadOption(LoadOptions, "opt3"_XS8);
//
// if ( LoadOptions != "opt1 opt2 opt3"_XS8 ) return 10;
//
// XString LoadOptions1 = RemoveLoadOption(LoadOptions, "opt1"_XS8);
// if ( LoadOptions1 != "opt2 opt3"_XS8 ) return 11;
// XString LoadOptions2 = RemoveLoadOption(LoadOptions, "opt2"_XS8);
// if ( LoadOptions2 != "opt1 opt3"_XS8 ) return 12;
// XString LoadOptions3 = RemoveLoadOption(LoadOptions, "opt3"_XS8);
// if ( LoadOptions3 != "opt1 opt2"_XS8 ) return 13;
// }
{
XString8Array LoadOptions;

View File

@ -122,83 +122,6 @@ const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const
return *IconX;
}
//
//XString AddLoadOption(IN CONST XString& LoadOptions, IN CONST XString& LoadOption)
//{
// // LoadOptions assumed out
// // If either option strings are null nothing to do
// if (LoadOptions.isEmpty()) //initially empty so return new option even if empty
// {
// // return LoadOption
// return LoadOption;
// }
// // If there is no option or it is already present duplicate original
// else {
// if ( LoadOptions.contains(LoadOption) ) return LoadOptions; //good
// // Otherwise add option
//// return SPrintf("%s %s", LoadOptions.c_str(), LoadOption.c_str()); //LoadOptions + LoadOption
// return LoadOptions + " "_XS8 + LoadOption; //why not?
// }
//}
//
//XString RemoveLoadOption(IN const XString& LoadOptions, IN const XString& LoadOption)
//{
//// CONST CHAR16 *Placement;
//// CHAR16 *NewLoadOptions;
//// UINTN Length, Offset, OptionLength;
//
// //DBG("LoadOptions: '%ls', remove LoadOption: '%ls'\n", LoadOptions, LoadOption);
// // If there are no options then nothing to do
// if (LoadOptions.isEmpty()) return ""_XS8;
// // If there is no option to remove then duplicate original
// if (LoadOption.isEmpty()) return LoadOptions;
// // If not present duplicate original
// xsize Offset = LoadOptions.indexOf(LoadOption);
// if ( Offset == MAX_XSIZE ) return LoadOptions;
//
// // Get placement of option in original options
//// Offset = (Placement - LoadOptions);
// xsize Length = LoadOptions.length();
// xsize OptionLength = LoadOption.length();
//
// // If this is just part of some larger option (contains non-space at the beginning or end)
// if ((Offset > 0 && LoadOptions[Offset - 1] != ' ') ||
// ((Offset + OptionLength) < Length && LoadOptions[Offset + OptionLength] != ' ')) {
// return LoadOptions;
// }
//
// // Consume preceeding spaces
// while (Offset > 0 && LoadOptions[Offset - 1] == ' ') {
// OptionLength++;
// Offset--;
// }
//
// // Consume following spaces
// while (LoadOptions[Offset + OptionLength] == ' ') {
// OptionLength++;
// }
//
// // If it's the whole string return NULL
// if (OptionLength == Length) return ""_XS8;
//
// XString NewLoadOptions;
// if (Offset == 0) {
// // Simple case - we just need substring after OptionLength position
// NewLoadOptions = LoadOptions.subString(OptionLength, MAX_XSIZE);
// } else {
// // Copy preceeding substring
// NewLoadOptions = LoadOptions.subString(0, Offset);
//// CopyMem(NewLoadOptions, LoadOptions, Offset * sizeof(CHAR16));
// if ((Offset + OptionLength) < Length) {
// // Copy following substring, but include one space also
// OptionLength--;
// NewLoadOptions += LoadOptions.subString(Offset + OptionLength, MAX_XSIZE);
//// CopyMem(NewLoadOptions + Offset, LoadOptions + Offset + OptionLength, (Length - OptionLength - Offset) * sizeof(CHAR16));
// }
// }
// return NewLoadOptions;
//}
#define TO_LOWER(ch) (((ch >= L'A') && (ch <= L'Z')) ? ((ch - L'A') + L'a') : ch)
INTN StrniCmp(IN CONST CHAR16 *Str1,
IN CONST CHAR16 *Str2,

View File

@ -10,9 +10,6 @@
#include "../cpp_foundation/XString.h"
//XString AddLoadOption(IN const XString& LoadOptions, IN const XString& LoadOption);
//XString RemoveLoadOption(IN const XString& LoadOptions, IN const XString& LoadOption);
INTN
StrniCmp (
IN CONST CHAR16 *Str1,

View File

@ -2597,109 +2597,6 @@ GetListOfThemes ()
DirIterClose(&DirIter);
}
////
//// analyze self.getSelfLoadedImage().LoadOptions to extract Default Volume and Default Loader
//// input and output data are global
////
//void
//GetBootFromOption(void)
//{
// UINT8 *Data = (UINT8*)self.getSelfLoadedImage().LoadOptions;
// UINTN Len = self.getSelfLoadedImage().LoadOptionsSize;
// UINTN NameSize, Name2Size;
//
// Data += 4; //skip signature as we already here
// NameSize = *(UINT16*)Data;
//
// Data += 2; // pointer to Volume name
// settingsData.Boot.DefaultVolume.strncpy((__typeof__(settingsData.Boot.DefaultVolume.wc_str()))Data, NameSize);
//
// Data += NameSize;
// Name2Size = Len - NameSize;
// if (Name2Size != 0) {
// settingsData.Boot.DefaultLoader.strncpy((__typeof__(settingsData.Boot.DefaultVolume.wc_str()))Data, NameSize);
// }
//
// DBG("Clover started with option to boot %ls from %ls\n",
// settingsData.Boot.DefaultLoader.notEmpty() ? settingsData.Boot.DefaultLoader.wc_str() : L"legacy",
// settingsData.Boot.DefaultVolume.wc_str());
//}
//void
//ParseLoadOptions (
// OUT XStringW* ConfNamePtr,
// OUT TagDict** Dict
// )
//{
// CHAR8 *End;
// CHAR8 *Start;
// UINTN TailSize;
// UINTN i;
// CONST CHAR8 *PlistStrings[] =
// {
// "<?xml",
// "<!DOCTYPE plist",
// "<plist",
// "<dict>",
// "\0"
// };
//
// UINTN PlistStringsLen;
// *Dict = NULL;
//
// XStringW& ConfName = *ConfNamePtr;
//
// Start = (CHAR8*)self.getSelfLoadedImage().LoadOptions;
// End = (CHAR8*)((CHAR8*)self.getSelfLoadedImage().LoadOptions + self.getSelfLoadedImage().LoadOptionsSize);
// while ((Start < End) && ((*Start == ' ') || (*Start == '\\') || (*Start == '/')))
// {
// ++Start;
// }
//
// TailSize = End - Start;
// //DBG("TailSize = %d\n", TailSize);
//
// if ((TailSize) <= 0) {
// return;
// }
//
// for (i = 0; PlistStrings[i][0] != '\0'; i++) {
// PlistStringsLen = AsciiStrLen(PlistStrings[i]);
// //DBG("PlistStrings[%d] = %s\n", i, PlistStrings[i]);
// if (PlistStringsLen < TailSize) {
// if (AsciiStriNCmp(PlistStrings[i], Start, PlistStringsLen)) {
// DBG(" - found plist string = %s, parse XML in LoadOptions\n", PlistStrings[i]);
// if (ParseXML(Start, Dict, TailSize) != EFI_SUCCESS) {
// *Dict = NULL;
// DBG(" - [!] xml in load options is bad\n");
// return;
// }
// return;
// }
// }
// }
//
// while ((End > Start) && ((*End == ' ') || (*End == '\\') || (*End == '/'))) {
// --End;
// }
//
// TailSize = End - Start;
// // DBG("TailSize2 = %d\n", TailSize);
//
// if (TailSize > 6) {
// if (AsciiStriNCmp(".plist", End - 6, 6)) {
// End -= 6;
// TailSize -= 6;
// // DBG("TailSize3 = %d\n", TailSize);
// }
// } else if (TailSize <= 0) {
// return;
// }
//
// ConfName.strncpy(Start, TailSize + 1);
//}
//
// main entry point
//
@ -2718,25 +2615,12 @@ RefitMain (IN EFI_HANDLE ImageHandle,
INTN DefaultIndex;
UINTN MenuExit;
UINTN i;
//UINT64 TscDiv;
//UINT64 TscRemainder = 0;
// LOADER_ENTRY *LoaderEntry;
// XStringW ConfName;
// TagDict* smbiosTags = NULL;
// XBool UniteConfigs = false;
EFI_TIME Now;
XBool HaveDefaultVolume;
REFIT_MENU_SCREEN BootScreen;
BootScreen.isBootScreen = true; //other screens will be constructed as false
// CHAR16 *InputBuffer; //, *Y;
// EFI_INPUT_KEY Key;
// Init assets dir: misc
/*Status = */ //egMkDir(&self.getCloverDir(), L"misc");
//Should apply to: "ACPI/origin/" too
MemLogInit();
//gSettings.GUI.TextOnly = true;
// bootstrap
gST = SystemTable;