XStringArray self assignament test.

Rename SPrintf S8Printf.
Rename NullXString NullXString8.
Rename XStringArray XString8Array.
This commit is contained in:
jief666 2020-08-11 09:00:19 +03:00
parent 1c4bb3f823
commit 7765a988fe
23 changed files with 169 additions and 229 deletions

View File

@ -261,16 +261,12 @@
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */ = {
isa = PBXGroup;
children = (
9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */,
9A9EA7F6245AAB310076EC02 /* XToolsCommon_test.h */,
9A4FFA802451C88D0050B38B /* XString_test.cpp */,
9A4FFA7F2451C88C0050B38B /* XString_test.h */,
9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */,
9A4185B02439E4D600BEAFB8 /* LoadOptions_test.h */,
9A0B08512402FE9B00E2B470 /* all_tests.cpp */,
9A0B08542402FE9B00E2B470 /* all_tests.h */,
9A0B08642403144C00E2B470 /* global_test.cpp */,
9A57C20A2418A1FD0029A39F /* global_test.h */,
9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */,
9A4185B02439E4D600BEAFB8 /* LoadOptions_test.h */,
9AF41572242CBE7600D2644C /* poolprint-test-cpp_conf.h */,
9AF41571242CBE7600D2644C /* poolprint-test.cpp */,
9AF41575242CBE7600D2644C /* poolprint-test.h */,
@ -290,8 +286,12 @@
9A0B084E2402FE9B00E2B470 /* XArray_tests.h */,
9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */,
9A0B08502402FE9B00E2B470 /* XObjArray_tests.h */,
9A4FFA802451C88D0050B38B /* XString_test.cpp */,
9A4FFA7F2451C88C0050B38B /* XString_test.h */,
9A0B084F2402FE9B00E2B470 /* XStringArray_test.cpp */,
9A0B084D2402FE9B00E2B470 /* XStringArray_test.h */,
9A9EA7F7245AAB310076EC02 /* XToolsCommon_test.cpp */,
9A9EA7F6245AAB310076EC02 /* XToolsCommon_test.h */,
);
name = cpp_unit_test;
path = ../../rEFIt_UEFI/cpp_unit_test;

View File

@ -1370,7 +1370,7 @@ EFI_STATUS SetStartupDiskVolume (
//
if (Guid != NULL) {
XString8 EfiBootDevice;
EfiBootDevice.SPrintf(
EfiBootDevice.S8Printf(
"<array><dict>"
"<key>IOMatch</key>"
"<dict>"

View File

@ -1820,12 +1820,12 @@ FillinCustomEntry (
// } else {
// Entry->Options.SPrintf("%s", Prop->string);
// }
Entry->LoadOptions.import(Split<XStringArray>(Prop->string, " "));
Entry->LoadOptions.import(Split<XString8Array>(Prop->string, " "));
} else {
Prop = GetProperty(DictPointer, "Arguments");
if (Prop != NULL && (Prop->type == kTagTypeString)) {
// Entry->Options.SPrintf("%s", Prop->string);
Entry->LoadOptions = Split<XStringArray>(Prop->string, " ");
Entry->LoadOptions = Split<XString8Array>(Prop->string, " ");
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTARGS);
}
}
@ -2242,7 +2242,7 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, TagPtr DictPointer)
// } else {
// Entry->Options.SPrintf("%s", Prop->string);
// }
Entry->LoadOptions = Split<XStringArray>(Prop->string, " ");
Entry->LoadOptions = Split<XString8Array>(Prop->string, " ");
}
Prop = GetProperty(DictPointer, "FullTitle");
@ -6268,7 +6268,7 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (OSTYPE_IS_OSX(Entry->LoaderType))
{
XString8 uuidPrefix;
if ( Entry->APFSTargetUUID.notEmpty() ) uuidPrefix = SPrintf("\\%ls", Entry->APFSTargetUUID.wc_str());
if ( Entry->APFSTargetUUID.notEmpty() ) uuidPrefix = S8Printf("\\%ls", Entry->APFSTargetUUID.wc_str());
XStringW plist = SWPrintf("%s\\System\\Library\\CoreServices\\SystemVersion.plist", uuidPrefix.c_str());
if ( !FileExists(Entry->Volume->RootDir, plist) ) {
@ -6512,7 +6512,7 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (OSTYPE_IS_OSX_RECOVERY (Entry->LoaderType)) {
XString8 uuidPrefix;
if ( Entry->APFSTargetUUID.notEmpty() ) uuidPrefix = SPrintf("\\%ls", Entry->APFSTargetUUID.wc_str());
if ( Entry->APFSTargetUUID.notEmpty() ) uuidPrefix = S8Printf("\\%ls", Entry->APFSTargetUUID.wc_str());
XStringW plist = SWPrintf("%s\\SystemVersion.plist", uuidPrefix.c_str());
if ( !FileExists(Entry->Volume->RootDir, plist) ) {

View File

@ -104,7 +104,7 @@ struct CUSTOM_LOADER_ENTRY {
XStringW DriveImagePath;
XStringW Volume;
XStringW Path;
XStringArray LoadOptions;
XString8Array LoadOptions;
XStringW FullTitle;
XStringW Title;
@ -161,7 +161,7 @@ public:
XStringW ImagePath;
XStringW Volume;
XStringW Path;
XStringArray LoadOptions;
XString8Array LoadOptions;
XStringW FullTitle;
XStringW Title;
CHAR16 Hotkey;

View File

@ -75,7 +75,7 @@ XString8 get_pci_dev_path(pci_dt_t *PciDt)
DevicePath = DevicePathFromHandle(PciDt->DeviceHandle);
if (!DevicePath)
return NullXString;
return NullXString8;
returnValue = FileDevicePathToXStringW(DevicePath);
return returnValue;

View File

@ -384,7 +384,7 @@ XStringW GuidLEToXStringW(EFI_GUID *Guid)
XString8 GuidLEToXString8(EFI_GUID *Guid)
{
XString8 returnValue;
returnValue.SPrintf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
returnValue.S8Printf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
Guid->Data1, Guid->Data2, Guid->Data3, Guid->Data4[0], Guid->Data4[1],
Guid->Data4[2], Guid->Data4[3], Guid->Data4[4], Guid->Data4[5], Guid->Data4[6], Guid->Data4[7]);
return returnValue;

View File

@ -20,63 +20,20 @@
#include "../../Include/Library/printf_lite.h"
//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------
//
//constexpr LString8 operator"" _XS8 ( const char* s, size_t len)
//{
//// LString8 returnValue;
//// returnValue.takeValueFromLiteral(s);
//// (void)len;
//// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
// return LString8(s); // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
//}
//
//XString16 operator"" _XS16 ( const char16_t* s, size_t len)
//{
// XString16 returnValue;
// returnValue.takeValueFromLiteral(s);
// (void)len;
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
//}
//
//XString32 operator"" _XS32 ( const char32_t* s, size_t len)
//{
// XString32 returnValue;
// returnValue.takeValueFromLiteral(s);
// (void)len;
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
//}
//
//XStringW operator"" _XSW ( const wchar_t* s, size_t len)
//{
// XStringW returnValue;
// returnValue.takeValueFromLiteral(s);
// (void)len;
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
//}
const XString8 NullXString;
const XString8 NullXString8;
const XString16 NullXString16;
const XString32 NullXString32;
const XStringW NullXStringW;
//template<class O/*, enable_if(is_char(O))*/>
//XStringW LStringW::operator + (const O* p2) { XStringW s; s.strcat(this->s()); s.strcat(p2); return s; }
//
//template<>
//XStringW LStringW::operator + (const wchar_t* p2) { XStringW s; s.strcat(this->s()); s.strcat(p2); return s; }
XString8 SPrintf(const char* format, ...)
XString8 S8Printf(const char* format, ...)
{
va_list va;
XString8 str;
va_start (va, format);
str.vSPrintf(format, va);
str.vS8Printf(format, va);
va_end(va);
return str;

View File

@ -49,22 +49,22 @@ class XString8 : public XStringAbstract<char, XString8>
using XStringAbstract<char, XString8>::operator =;
protected:
static void transmitSPrintf(const char* buf, unsigned int nbchar, void* context)
static void transmitS8Printf(const char* buf, unsigned int nbchar, void* context)
{
((XString8*)(context))->strncat(buf, nbchar);
}
public:
void vSPrintf(const char* format, va_list va)
void vS8Printf(const char* format, va_list va)
{
setEmpty();
vprintf_with_callback(format, va, transmitSPrintf, this);
vprintf_with_callback(format, va, transmitS8Printf, this);
}
void SPrintf(const char* format, ...) __attribute__((__format__(__printf__, 2, 3)))
void S8Printf(const char* format, ...) __attribute__((__format__(__printf__, 2, 3)))
{
va_list va;
va_start (va, format);
vSPrintf(format, va);
vS8Printf(format, va);
va_end(va);
}
};
@ -136,7 +136,7 @@ class LStringW : public LString<wchar_t, XStringW>
class XStringW : public XStringAbstract<wchar_t, XStringW>
{
public:
public:
XStringW() : XStringAbstract<wchar_t, XStringW>() {};
XStringW(const XStringW& S) : XStringAbstract<wchar_t, XStringW>(S) {}
XStringW(const LStringW& S) : XStringAbstract<wchar_t, XStringW>(S) { }
@ -149,8 +149,6 @@ class XStringW : public XStringAbstract<wchar_t, XStringW>
using XStringAbstract<wchar_t, XStringW>::operator =;
protected:
static void transmitSPrintf(const wchar_t* buf, unsigned int nbchar, void* context)
{
@ -178,14 +176,14 @@ constexpr LString16 operator "" _XS16 ( const char16_t* s, size_t len);
constexpr LString32 operator "" _XS32 ( const char32_t* s, size_t len);
constexpr LStringW operator "" _XSW ( const wchar_t* s, size_t len);
extern const XString8 NullXString;
extern const XString8 NullXString8;
extern const XStringW NullXStringW;
#ifdef _MSC_VER
# define __attribute__(x)
#endif
XString8 SPrintf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));
XString8 S8Printf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));
XStringW SWPrintf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));

View File

@ -8,5 +8,5 @@
#include "XStringArray.h"
const XStringArray NullXStringArray;
const XString8Array NullXString8Array;
const XStringWArray NullXStringWArray;

View File

@ -84,68 +84,40 @@ class XStringArray_/* : public XStringArraySuper*/
template<typename IntegralType, enable_if(is_integral(IntegralType))>
XStringClass& elementAt(IntegralType i) { return array[i]; }
template<class Type1, class Type2, class Type3,
enable_if(
( is_char(Type1) || is_char_ptr(Type1) || is___String(Type1) ) &&
( is_char(Type2) || is_char_ptr(Type2) || is___String(Type2) ) &&
( is_char(Type3) || is_char_ptr(Type3) || is___String(Type3) )
)
>
XStringClass ConcatAll(const Type1& Separator, const Type2& Prefix, const Type3& Suffix) const
{
xsize i;
XStringClass s;
// template<class XStringClass1, class XStringClass2, class XStringClass3, enable_if(is___String(XStringClass1) && is___String(XStringClass2) && is___String(XStringClass3))>
// XStringClass ConcatAll(const XStringClass1& Separator, const XStringClass2& Prefix, const XStringClass3& Suffix) const
// {
// xsize i;
// XStringClass s;
//
// if ( array.size() > 0 ) {
// s = Prefix;
// s += array.ElementAt(0);
// for ( i=1 ; i<array.size() ; i+=1 ) {
// s += Separator;
// s += array.ElementAt(i);
// }
// s += Suffix;
// }
// return s;
// }
template<class Type1, class Type2, class Type3,
enable_if(
( is_char(Type1) || is_char_ptr(Type1) || is___String(Type1) ) &&
( is_char(Type2) || is_char_ptr(Type2) || is___String(Type2) ) &&
( is_char(Type3) || is_char_ptr(Type3) || is___String(Type3) )
)
>
XStringClass ConcatAll(const Type1& Separator, const Type2& Prefix, const Type3& Suffix) const
{
// auto separator = _xstringarray__char_type<Type1>::getCharPtr(Separator);
// auto prefix = _xstringarray__char_type<Type2>::getCharPtr(Prefix);
// auto suffix = _xstringarray__char_type<Type3>::getCharPtr(Suffix);
xsize i;
XStringClass s;
if ( array.size() > 0 ) {
s.takeValueFrom(Prefix);
s += array.ElementAt(0);
for ( i=1 ; i<array.size() ; i+=1 ) {
s += Separator;
s += array.ElementAt(i);
}
s += Suffix;
}
return s;
}
if ( array.size() > 0 ) {
s.takeValueFrom(Prefix);
s += array.ElementAt(0);
for ( i=1 ; i<array.size() ; i+=1 ) {
s += Separator;
s += array.ElementAt(i);
}
s += Suffix;
}
return s;
}
XStringClass ConcatAll() const
{
return ConcatAll(", ", "", "");
}
// template<class XStringClass1, enable_if(is___String(XStringClass1))>
// XStringClass ConcatAll(const XStringClass1& Separator) const
// {
// return ConcatAll(Separator, NullXString, NullXString);
// }
template<class Type1, enable_if(is_char(Type1) || is_char_ptr(Type1) || is___String(Type1))>
XStringClass ConcatAll(const Type1& Separator) const
{
return ConcatAll(Separator, "", "");
}
template<class Type1, enable_if(is_char(Type1) || is_char_ptr(Type1) || is___String(Type1))>
XStringClass ConcatAll(const Type1& Separator) const
{
return ConcatAll(Separator, "", "");
}
template<class OtherXStringArrayClass>
@ -314,10 +286,10 @@ class XStringArray_/* : public XStringArraySuper*/
};
class XStringArray : public XStringArray_<XString8>
class XString8Array : public XStringArray_<XString8>
{
};
extern const XStringArray NullXStringArray;
extern const XString8Array NullXString8Array;
class XString16Array : public XStringArray_<XString16>
{

View File

@ -29,7 +29,7 @@ int BootOptions_tests()
// if ( LoadOptions3 != "opt1 opt2"_XS8 ) return 13;
// }
{
XStringArray LoadOptions;
XString8Array LoadOptions;
LoadOptions.AddID("opt1"_XS8);
LoadOptions.AddID("opt2"_XS8);
@ -37,13 +37,13 @@ int BootOptions_tests()
if ( LoadOptions.ConcatAll(" "_XS8) != "opt1 opt2 opt3"_XS8 ) return 30;
XStringArray LoadOptions1 = LoadOptions;
XString8Array LoadOptions1 = LoadOptions;
LoadOptions1.remove("opt1"_XS8);
if ( LoadOptions1.ConcatAll(" "_XS8) != "opt2 opt3"_XS8 ) return 31;
XStringArray LoadOptions2 = LoadOptions;
XString8Array LoadOptions2 = LoadOptions;
LoadOptions2.remove("opt2"_XS8);
if ( LoadOptions2.ConcatAll(" "_XS8) != "opt1 opt3"_XS8 ) return 32;
XStringArray LoadOptions3 = LoadOptions;
XString8Array LoadOptions3 = LoadOptions;
LoadOptions3.remove("opt3"_XS8);
if ( LoadOptions3.ConcatAll(" "_XS8) != "opt1 opt2"_XS8 ) return 33;
}

View File

@ -40,25 +40,25 @@ int XStringArray_tests()
// Split
{
XStringArray array = Split<XStringArray>(" word1 word2 word3 ", " ");
XString8Array array = Split<XString8Array>(" word1 word2 word3 ", " ");
if ( array[0] != "word1"_XS8 ) return 31;
if ( array[1] != "word2"_XS8 ) return 32;
if ( array[2] != "word3"_XS8 ) return 33;
}
{
XStringArray array = Split<XStringArray>("word1, word2, word3", ", ");
XString8Array array = Split<XString8Array>("word1, word2, word3", ", ");
if ( array[0] != "word1"_XS8 ) return 41;
if ( array[1] != "word2"_XS8 ) return 42;
if ( array[2] != "word3"_XS8 ) return 43;
}
{
XStringArray array = Split<XStringArray>(" word1 word2 word3 "_XS8, " "_XS8);
XString8Array array = Split<XString8Array>(" word1 word2 word3 "_XS8, " "_XS8);
if ( array[0] != "word1"_XS8 ) return 51;
if ( array[1] != "word2"_XS8 ) return 52;
if ( array[2] != "word3"_XS8 ) return 53;
}
{
XStringArray array = Split<XStringArray>(" word1 word2 word3 "_XS8, " "_XS8);
XString8Array array = Split<XString8Array>(" word1 word2 word3 "_XS8, " "_XS8);
XString8 xs = array.ConcatAll(' ', '^', '$');
if ( xs != "^word1 word2 word3$"_XS8 ) return 31;
}
@ -84,14 +84,14 @@ int XStringArray_tests()
XStringWArray arraybis = Split<XStringWArray>(c);
if ( array != arraybis ) return 20;
XStringArray array3bis = Split<XStringArray>(c);
XString8Array array3bis = Split<XString8Array>(c);
if ( array != array3bis ) return 20;
}
// Test Split char[64]
{
char buf[64];
strcpy(buf, "word1 other2 3333 4th_item");
XStringArray array = Split<XStringArray>(buf, " ");
XString8Array array = Split<XString8Array>(buf, " ");
if ( array[0] != "word1"_XS8 ) return 31;
if ( array[1] != "other2"_XS8 ) return 32;
@ -100,24 +100,24 @@ int XStringArray_tests()
}
// Test concat and Split @Pene
{
XStringArray array;
XString8Array array;
array.Add(L"word1");
array.Add(L"other2");
array.Add(L"3333");
array.Add(L"4th_item");
XStringArray LoadOptions2;
XString8Array LoadOptions2;
LoadOptions2 = Split<XStringArray>(array.ConcatAll(" "_XS8).wc_str(), " ");
LoadOptions2 = Split<XString8Array>(array.ConcatAll(" "_XS8).wc_str(), " ");
if ( LoadOptions2 != array ) return 22;
LoadOptions2 = Split<XStringArray>(array.ConcatAll(" "_XS8), " ");
LoadOptions2 = Split<XString8Array>(array.ConcatAll(" "_XS8), " ");
if ( LoadOptions2 != array ) return 22;
LoadOptions2 = Split<XStringArray>(array.ConcatAll(" "_XS8), " "_XS8);
LoadOptions2 = Split<XString8Array>(array.ConcatAll(" "_XS8), " "_XS8);
if ( LoadOptions2 != array ) return 22;
LoadOptions2 = Split<XStringArray>(array.ConcatAll(" "), " ");
LoadOptions2 = Split<XString8Array>(array.ConcatAll(" "), " ");
if ( LoadOptions2 != array ) return 22;
LoadOptions2 = array;
@ -156,20 +156,33 @@ int XStringArray_tests()
if ( array1.size() != 4 ) return 53;
}
{
XStringArray array;
XString8Array array;
array.Add(L"word1");
array.Add(L"other2");
array.Add(L"3333");
array.Add(L"4th_item");
XStringArray array2 = array;
XString8Array array2 = array;
if ( array2 != array ) return 22;
XStringArray* array2Ptr = &array2;
XString8Array* array2Ptr = &array2;
*array2Ptr = array2;
if ( array2 != array ) return 22;
}
}
{
XStringArray array;
XString8Array array;
array.Add(L"word1");
array.Add(L"other2");
array.Add(L"3333");
array.Add(L"4th_item");
XString8Array array2 = array;
if ( array2 != array ) return 22;
XString8Array* array2Ptr = &array2;
*array2Ptr = array2;
if ( array2 != array ) return 22;
}
{
XString8Array array;
array.Add(L"word1");
array.Add(L"other2");
array.Add(L"3333");
@ -187,7 +200,7 @@ int XStringArray_tests()
// printf("c=%s\n", c.c_str());
}
{
XStringArray array;
XString8Array array;
array.Add(L"splash");
array.Add(L"quiet");

View File

@ -67,7 +67,7 @@ const XStringW LINUX_ISSUE_PATH = L"\\etc\\issue"_XSW;
const XString8 LINUX_LOADER_PATH = "vmlinuz"_XS8;
const XStringW LINUX_FULL_LOADER_PATH = SWPrintf("%ls\\%s", LINUX_BOOT_PATH, LINUX_LOADER_PATH.c_str());
#define LINUX_LOADER_SEARCH_PATH L"vmlinuz*"
const XStringArray LINUX_DEFAULT_OPTIONS = Split<XStringArray>("ro add_efi_memmap quiet splash vt.handoff=7", " ");
const XString8Array LINUX_DEFAULT_OPTIONS = Split<XString8Array>("ro add_efi_memmap quiet splash vt.handoff=7", " ");
#if defined(MDE_CPU_X64)
#define BOOT_LOADER_PATH L"\\EFI\\BOOT\\BOOTX64.efi"_XSW
@ -350,10 +350,10 @@ STATIC CONST XString8 LinuxInitImagePath[] = {
};
STATIC CONST UINTN LinuxInitImagePathCount = (sizeof(LinuxInitImagePath) / sizeof(LinuxInitImagePath[0]));
STATIC XStringArray LinuxKernelOptions(IN EFI_FILE_PROTOCOL *Dir,
STATIC XString8Array LinuxKernelOptions(IN EFI_FILE_PROTOCOL *Dir,
IN CONST CHAR16 *Version,
IN CONST CHAR16 *PartUUID,
IN CONST XStringArray& Options OPTIONAL)
IN CONST XString8Array& Options OPTIONAL)
{
UINTN Index = 0;
if ((Dir == NULL) || (PartUUID == NULL)) {
@ -363,17 +363,17 @@ STATIC XStringArray LinuxKernelOptions(IN EFI_FILE_PROTOCOL *Dir,
XStringW InitRd = SWPrintf(LinuxInitImagePath[Index++].c_str(), (Version == NULL) ? L"" : Version);
if (InitRd.notEmpty()) {
if (FileExists(Dir, InitRd)) {
XStringArray CustomOptions;
CustomOptions.Add(SPrintf("root=/dev/disk/by-partuuid/%ls", PartUUID));
CustomOptions.Add(SPrintf("initrd=%ls\\%ls", LINUX_BOOT_ALT_PATH, InitRd.wc_str()));
XString8Array CustomOptions;
CustomOptions.Add(S8Printf("root=/dev/disk/by-partuuid/%ls", PartUUID));
CustomOptions.Add(S8Printf("initrd=%ls\\%ls", LINUX_BOOT_ALT_PATH, InitRd.wc_str()));
CustomOptions.import(LINUX_DEFAULT_OPTIONS);
CustomOptions.import(Options);
return CustomOptions;
}
}
}
XStringArray CustomOptions;
CustomOptions.Add(SPrintf("root=/dev/disk/by-partuuid/%ls", PartUUID));
XString8Array CustomOptions;
CustomOptions.Add(S8Printf("root=/dev/disk/by-partuuid/%ls", PartUUID));
CustomOptions.import(LINUX_DEFAULT_OPTIONS);
CustomOptions.import(Options);
return CustomOptions;
@ -439,7 +439,7 @@ STATIC EFI_STATUS GetOSXVolumeName(LOADER_ENTRY *Entry)
return Status;
}
STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
IN CONST XStringArray& LoaderOptions,
IN CONST XString8Array& LoaderOptions,
IN CONST XStringW& FullTitle,
IN CONST XStringW& LoaderTitle,
IN REFIT_VOLUME *Volume,
@ -591,7 +591,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
if (OSFLAG_ISSET(Flags, OSFLAG_NODEFAULTARGS)) {
Entry->LoadOptions = LoaderOptions;
}else{
Entry->LoadOptions = Split<XStringArray>(gSettings.BootArgs, " ");
Entry->LoadOptions = Split<XString8Array>(gSettings.BootArgs, " ");
Entry->LoadOptions.import(LoaderOptions);
}
//actions
@ -990,7 +990,7 @@ void LOADER_ENTRY::AddDefaultMenu()
// DBG(" Added '%ls': OSType='%d', OSVersion='%s'\n",Title,LoaderType,OSVersion);
}
LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XStringArray& LoaderOptions,
LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Array& LoaderOptions,
IN CONST XStringW& FullTitle, IN CONST XStringW& LoaderTitle,
IN REFIT_VOLUME *Volume, IN const XStringW& APFSTargetUUID, IN XIcon *Image,
IN UINT8 OSType, IN UINT8 Flags)
@ -1096,7 +1096,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
DirIterClose(&DirIter);
return;
}
AddLoaderEntry(File, NullXStringArray, L""_XSW, LoaderTitle, Volume, L""_XSW,
AddLoaderEntry(File, NullXString8Array, L""_XSW, LoaderTitle, Volume, L""_XSW,
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS);
} //anyway continue search other entries
}
@ -1118,7 +1118,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
}
return;
}
AddLoaderEntry(LinuxEntryData[Index].Path, NullXStringArray, L""_XSW, XStringW().takeValueFrom(LinuxEntryData[Index].Title), Volume, L""_XSW,
AddLoaderEntry(LinuxEntryData[Index].Path, NullXString8Array, L""_XSW, XStringW().takeValueFrom(LinuxEntryData[Index].Title), Volume, L""_XSW,
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS);
}
}
@ -1244,7 +1244,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
DirIterClose(&Iter);
return;
}
XStringArray Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXStringArray);
XString8Array Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXString8Array);
// Add the entry
AddLoaderEntry(Path, (Options.isEmpty()) ? LINUX_DEFAULT_OPTIONS : Options, L""_XSW, L""_XSW, Volume, L""_XSW, NULL, OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
Path.setEmpty();
@ -1259,7 +1259,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
if (FileInfo->FileSize > 0) {
// get the kernel file path
Path.SWPrintf("%ls\\%ls", LINUX_BOOT_PATH, FileInfo->FileName);
XStringArray Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXStringArray);
XString8Array Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXString8Array);
// Add the entry
AddLoaderEntry(Path, (Options.isEmpty()) ? LINUX_DEFAULT_OPTIONS : Options, L""_XSW, L""_XSW, Volume, L""_XSW, NULL, OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
Path.setEmpty();
@ -1296,16 +1296,16 @@ VOID AddPRSEntry(REFIT_VOLUME *Volume)
switch (WhatBoot) {
case Paper:
case (Paper | Rock):
AddLoaderEntry(PaperBoot, NullXStringArray, L""_XSW, L"macOS InstallP"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(PaperBoot, NullXString8Array, L""_XSW, L"macOS InstallP"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
break;
case Scissor:
case (Paper | Scissor):
AddLoaderEntry(ScissorBoot, NullXStringArray, L""_XSW, L"macOS InstallS"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(ScissorBoot, NullXString8Array, L""_XSW, L"macOS InstallS"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
break;
case Rock:
case (Rock | Scissor):
case (Rock | Scissor | Paper):
AddLoaderEntry(RockBoot, NullXStringArray, L""_XSW, L"macOS InstallR"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(RockBoot, NullXString8Array, L""_XSW, L"macOS InstallR"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
break;
default:
@ -1351,41 +1351,41 @@ VOID ScanLoader(VOID)
if (FileExists(Volume->RootDir, L"\\Install OS X Mavericks.app") ||
FileExists(Volume->RootDir, L"\\Install OS X Yosemite.app") ||
FileExists(Volume->RootDir, L"\\Install OS X El Capitan.app")) {
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.9 - 10.11
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.9 - 10.11
} else {
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.13.3
AddLoaderEntry(L"\\.IABootFiles\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.13.3
}
} else if (FileExists(Volume->RootDir, L"\\.IAPhysicalMedia") && FileExists(Volume->RootDir, MACOSX_LOADER_PATH)) {
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.13.4+
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.13.4+
}
// 2nd stage - InstallESD/AppStore/startosinstall/Fusion Drive
AddLoaderEntry(L"\\Mac OS X Install Data\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
AddLoaderEntry(L"\\OS X Install Data\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
AddLoaderEntry(L"\\macOS Install Data\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.12.3
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\Boot Files\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12.4+
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.16+
AddLoaderEntry(L"\\Mac OS X Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
AddLoaderEntry(L"\\OS X Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
AddLoaderEntry(L"\\macOS Install Data\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12 - 10.12.3
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\Boot Files\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12.4+
AddLoaderEntry(L"\\macOS Install Data\\Locked Files\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.16+
AddPRSEntry(Volume); // 10.12+
// Netinstall
AddLoaderEntry(L"\\NetInstall macOS High Sierra.nbi\\i386\\booter"_XSW, NullXStringArray, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(L"\\NetInstall macOS High Sierra.nbi\\i386\\booter"_XSW, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0);
// Use standard location for boot.efi, according to the install files is present
// That file indentifies a DVD/ESD/BaseSystem/Fusion Drive Install Media, so when present, check standard path to avoid entry duplication
if (FileExists(Volume->RootDir, MACOSX_LOADER_PATH)) {
if (FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\Mac OS X Installer.app")) {
// InstallDVD/BaseSystem
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.6/10.7
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.6/10.7
} else if (FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\OS X Installer.app")) {
// BaseSystem
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8 - 10.11
} else if (FileExists(Volume->RootDir, L"\\System\\Installation\\CDIS\\macOS Installer.app")) {
// BaseSystem
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12+
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.12+
} else if (FileExists(Volume->RootDir, L"\\BaseSystem.dmg") && FileExists(Volume->RootDir, L"\\mach_kernel")) {
// InstallESD
if (FileExists(Volume->RootDir, L"\\MacOSX_Media_Background.png")) {
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.7
} else {
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.8
}
} else if (FileExists(Volume->RootDir, L"\\com.apple.boot.R\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
FileExists(Volume->RootDir, L"\\com.apple.boot.P\\System\\Library\\PrelinkedKernels\\prelinkedkernel") ||
@ -1393,43 +1393,43 @@ VOID ScanLoader(VOID)
if (StriStr(Volume->VolName.wc_str(), L"Recovery") != NULL) {
// FileVault of HFS+
// TODO: need info for 10.11 and lower
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"macOS FileVault"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.12+
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS FileVault"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.12+
} else {
// Fusion Drive
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.11
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X Install"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX_INSTALLER, 0); // 10.11
}
} else if (!FileExists(Volume->RootDir, L"\\.IAPhysicalMedia")) {
// Installed
if (EFI_ERROR(GetRootUUID(Volume)) || isFirstRootUUID(Volume)) {
if (!FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\NotificationCenter.app") && !FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\Siri.app")) {
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"Mac OS X"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.6 - 10.7
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"Mac OS X"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.6 - 10.7
} else if (FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\NotificationCenter.app") && !FileExists(Volume->RootDir, L"\\System\\Library\\CoreServices\\Siri.app")) {
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"OS X"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.8 - 10.11
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"OS X"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.8 - 10.11
} else {
AddLoaderEntry(MACOSX_LOADER_PATH, NullXStringArray, L""_XSW, L"macOS"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.12+
AddLoaderEntry(MACOSX_LOADER_PATH, NullXString8Array, L""_XSW, L"macOS"_XSW, Volume, L""_XSW, NULL, OSTYPE_OSX, 0); // 10.12+
}
}
}
}
// check for Mac OS X Recovery Boot
AddLoaderEntry(L"\\com.apple.recovery.boot\\boot.efi"_XSW, NullXStringArray, L""_XSW, L"Recovery"_XSW, Volume, L""_XSW, NULL, OSTYPE_RECOVERY, 0);
AddLoaderEntry(L"\\com.apple.recovery.boot\\boot.efi"_XSW, NullXString8Array, L""_XSW, L"Recovery"_XSW, Volume, L""_XSW, NULL, OSTYPE_RECOVERY, 0);
// Sometimes, on some systems (HP UEFI, if Win is installed first)
// it is needed to get rid of bootmgfw.efi to allow starting of
// Clover as /efi/boot/bootx64.efi from HD. We can do that by renaming
// bootmgfw.efi to bootmgfw-orig.efi
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw-orig.efi"_XSW, NullXStringArray, L""_XSW, L"Microsoft EFI"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw-orig.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
// check for Microsoft boot loader/menu
// If there is bootmgfw-orig.efi, then do not check for bootmgfw.efi
// since on some systems this will actually be CloverX64.efi
// renamed to bootmgfw.efi
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw.efi"_XSW, NullXStringArray, L""_XSW, L"Microsoft EFI Boot"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
AddLoaderEntry(L"\\EFI\\microsoft\\Boot\\bootmgfw.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI Boot"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
// check for Microsoft boot loader/menu. This entry is redundant so excluded
// AddLoaderEntry(L"\\bootmgr.efi", L"", L"Microsoft EFI mgrboot", Volume, NULL, OSTYPE_WINEFI, 0);
// check for Microsoft boot loader/menu on CDROM
if (!AddLoaderEntry(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"_XSW, NullXStringArray, L""_XSW, L"Microsoft EFI cdboot"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0)) {
AddLoaderEntry(L"\\EFI\\MICROSOF\\BOOT\\CDBOOT.EFI"_XSW, NullXStringArray, L""_XSW, L"Microsoft EFI CDBOOT"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
if (!AddLoaderEntry(L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI cdboot"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0)) {
AddLoaderEntry(L"\\EFI\\MICROSOF\\BOOT\\CDBOOT.EFI"_XSW, NullXString8Array, L""_XSW, L"Microsoft EFI CDBOOT"_XSW, Volume, L""_XSW, NULL, OSTYPE_WINEFI, 0);
}
#if defined(ANDX86)
@ -1446,7 +1446,7 @@ VOID ScanLoader(VOID)
XIcon ImageX;
XStringW IconXSW = XStringW().takeValueFrom(AndroidEntryData[Index].Icon);
ImageX.LoadXImage(ThemeX.ThemeDir, (L"os_"_XSW + IconXSW.subString(0, IconXSW.indexOf(','))).wc_str());
AddLoaderEntry(AndroidEntryData[Index].Path, NullXStringArray, L""_XSW, XStringW().takeValueFrom(AndroidEntryData[Index].Title), Volume, L""_XSW,
AddLoaderEntry(AndroidEntryData[Index].Path, NullXString8Array, L""_XSW, XStringW().takeValueFrom(AndroidEntryData[Index].Title), Volume, L""_XSW,
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS);
}
}
@ -1460,15 +1460,15 @@ VOID ScanLoader(VOID)
// DBG("search for optical UEFI\n");
if (Volume->DiskKind == DISK_KIND_OPTICAL) {
AddLoaderEntry(BOOT_LOADER_PATH, NullXStringArray, L""_XSW, L"UEFI optical"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, 0);
AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI optical"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, 0);
}
// DBG("search for internal UEFI\n");
if (Volume->DiskKind == DISK_KIND_INTERNAL) {
AddLoaderEntry(BOOT_LOADER_PATH, NullXStringArray, L""_XSW, L"UEFI internal"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, OSFLAG_HIDDEN);
AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI internal"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, OSFLAG_HIDDEN);
}
// DBG("search for external UEFI\n");
if (Volume->DiskKind == DISK_KIND_EXTERNAL) {
AddLoaderEntry(BOOT_LOADER_PATH, NullXStringArray, L""_XSW, L"UEFI external"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, OSFLAG_HIDDEN);
AddLoaderEntry(BOOT_LOADER_PATH, NullXString8Array, L""_XSW, L"UEFI external"_XSW, Volume, L""_XSW, NULL, OSTYPE_OTHER, OSFLAG_HIDDEN);
}
}
@ -1518,11 +1518,11 @@ VOID ScanLoader(VOID)
}
}
if ( targetLoaderEntry ) {
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, SWPrintf("Boot Mac OS X from %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, OSFLAG_HIDDEN);
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXString8Array, SWPrintf("Boot Mac OS X from %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, OSFLAG_HIDDEN);
//Try to add Recovery APFS entry
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
//Try to add macOS install entry
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, L""_XSW, L"macOS Install Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, L""_XSW, L"macOS Install Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
}
else
{
@ -1535,17 +1535,17 @@ VOID ScanLoader(VOID)
}
}
if ( targetVolume ) {
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, SWPrintf("Boot Mac OS X from %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXString8Array, SWPrintf("Boot Mac OS X from %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
//Try to add Recovery APFS entry
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
//Try to add macOS install entry
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Install for %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, SWPrintf("Boot Mac OS X Install for %ls via %ls", targetVolume->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
} else {
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXStringArray, L""_XSW, L"FileVault Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
AddLoaderEntry(SWPrintf("\\%s\\System\\Library\\CoreServices\\boot.efi", ApfsTargetUUID.c_str()), NullXString8Array, L""_XSW, L"FileVault Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX, 0);
//Try to add Recovery APFS entry
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
AddLoaderEntry(SWPrintf("\\%s\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, SWPrintf("Boot Mac OS X Recovery for %ls via %ls", targetLoaderEntry->VolName.wc_str(), Volume->VolName.wc_str()), L""_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_RECOVERY, 0);
//Try to add macOS install entry
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXStringArray, L""_XSW, L"macOS Install Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
AddLoaderEntry(SWPrintf("\\%s\\com.apple.installer\\boot.efi", Volume->ApfsTargetUUIDArray[i].c_str()), NullXString8Array, L""_XSW, L"macOS Install Prebooter"_XSW, Volume, Volume->ApfsTargetUUIDArray[i], NULL, OSTYPE_OSX_INSTALLER, 0);
}
}
}
@ -1732,7 +1732,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
}
do { // when not scanning for kernels, this loop will execute only once
XStringArray CustomOptions = Custom->LoadOptions;
XString8Array CustomOptions = Custom->LoadOptions;
// for LINEFI with option KERNEL_SCAN_ALL, use this loop to search for kernels
if (FindCustomPath && Custom->Type == OSTYPE_LINEFI && Custom->KernelScan == KERNEL_SCAN_ALL) {

View File

@ -75,7 +75,7 @@
STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
IN REFIT_VOLUME *Volume, const XIcon& Image,
IN CHAR16 ShortcutLetter, IN CONST XStringArray& Options)
IN CHAR16 ShortcutLetter, IN CONST XString8Array& Options)
{
REFIT_MENU_ENTRY_LOADER_TOOL *Entry;
// Check the loader exists
@ -196,8 +196,8 @@ VOID ScanTool(VOID)
// DBG("Scanning for tools...\n");
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_SHELL)) {
if (!AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64U.efi"_XSW, NULL, L"UEFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXStringArray)) {
AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64.efi"_XSW, NULL, L"EFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXStringArray);
if (!AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64U.efi"_XSW, NULL, L"UEFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXString8Array)) {
AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64.efi"_XSW, NULL, L"EFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXString8Array);
}
}

View File

@ -2590,9 +2590,9 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
TimeoutSeconds = 0;
if (MenuExit == MENU_EXIT_DETAILS && MainChosenEntry->SubScreen != NULL) {
XStringArray TmpArgs;
XString8Array TmpArgs;
if (AsciiStrLen(gSettings.BootArgs) > 0) {
TmpArgs = Split<XStringArray>(gSettings.BootArgs, " ");
TmpArgs = Split<XString8Array>(gSettings.BootArgs, " ");
}
SubMenuIndex = -1;

View File

@ -265,7 +265,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
{
public:
XStringW DevicePathString;
XStringArray LoadOptions; //moved here for compatibility with legacy
XString8Array LoadOptions; //moved here for compatibility with legacy
XStringW LoaderPath;
XIcon DriveImage;
XIcon BadgeImage;

View File

@ -71,7 +71,7 @@ CONST CHAR16 *VBIOS_BIN = L"EFI\\CLOVER\\misc\\c0000.bin";
INPUT_ITEM *InputItems = NULL;
INTN TextStyle; //why global? It will be class SCREEN member
UINT32 EncodeOptions(const XStringArray& Options)
UINT32 EncodeOptions(const XString8Array& Options)
{
UINT32 OptionsBits = 0;
INTN Index;
@ -116,7 +116,7 @@ VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
gSettings.NvidiaWeb = TRUE;
} else {
//Entry->LoadOptions = loaderEntry->LoadOptions;
// Entry->LoadOptions = Split<XStringArray>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");
// Entry->LoadOptions = Split<XString8Array>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");
Entry->LoadOptions.AddID(ArgOptional[INX_NVWEBON]);
}
}
@ -125,7 +125,7 @@ VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
gSettings.NvidiaWeb = FALSE;
} else {
//Entry->LoadOptions = loaderEntry->LoadOptions;
// Entry->LoadOptions = Split<XStringArray>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");
// Entry->LoadOptions = Split<XString8Array>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");
Entry->LoadOptions.removeIC(ArgOptional[INX_NVWEBON]);
}
}

View File

@ -20,7 +20,7 @@ extern CONST CHAR16 *VBIOS_BIN;
extern INPUT_ITEM *InputItems;
VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry);
UINT32 EncodeOptions(const XStringArray& Options);
UINT32 EncodeOptions(const XString8Array& Options);

View File

@ -436,7 +436,7 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
EFI_STATUS XTheme::LoadSvgFrame(INTN i, OUT XImage* XFrame)
{
EFI_STATUS Status = EFI_NOT_FOUND;
XString8 XFrameName = SPrintf("frame_%04lld", i+1);
XString8 XFrameName = S8Printf("frame_%04lld", i+1);
Status = ParseSVGXIcon(BUILTIN_ICON_ANIME, XFrameName, XFrame, NULL); //svg anime will be full redesigned
if (EFI_ERROR(Status)) {
DBG("frame '%s' not loaded, status=%s\n", XFrameName.c_str(), strerror(Status));

View File

@ -280,7 +280,7 @@ public:
EFI_GUID RootUUID; //for recovery it is UUID of parent partition
UINT64 SleepImageOffset;
XString8 ApfsFileSystemUUID; // apfs file system UUID of that partition. It's not the UUID of subfolder like in Preboot.
XStringArray ApfsTargetUUIDArray; // this is the array of folders that are named as UUID
XString8Array ApfsTargetUUIDArray; // this is the array of folders that are named as UUID
REFIT_VOLUME() : DevicePath(0), DeviceHandle(0), RootDir(0), DiskKind(0), LegacyOS(0), Hidden(0), BootType(0), IsAppleLegacy(0), HasBootCode(0),
IsMbrPartition(0), MbrPartitionIndex(0), BlockIO(0), BlockIOOffset(0), WholeDiskBlockIO(0), WholeDiskDevicePath(0), WholeDiskDeviceHandle(0),

View File

@ -439,9 +439,9 @@ XString8 egScreenDescription(VOID)
{
if (egHasGraphics) {
if (GraphicsOutput != NULL) {
return SPrintf("Graphics Output (UEFI), %lldx%lld", egScreenWidth, egScreenHeight);
return S8Printf("Graphics Output (UEFI), %lldx%lld", egScreenWidth, egScreenHeight);
} else if (UgaDraw != NULL) {
return SPrintf("UGA Draw (EFI 1.10), %lldx%lld", egScreenWidth, egScreenHeight);
return S8Printf("UGA Draw (EFI 1.10), %lldx%lld", egScreenWidth, egScreenHeight);
} else {
return "Internal Error"_XS8;
}

View File

@ -726,7 +726,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
DBG("\n");
#endif
Volume->ApfsFileSystemUUID = APFSPartitionUUIDExtractAsXString8(Volume->DevicePath); // NullXString if it's not an APFS volume
Volume->ApfsFileSystemUUID = APFSPartitionUUIDExtractAsXString8(Volume->DevicePath); // NullXString8 if it's not an APFS volume
Volume->DiskKind = DISK_KIND_INTERNAL; // default
// get block i/o

View File

@ -200,7 +200,7 @@ bailout:
static EFI_STATUS StartEFILoadedImage(IN EFI_HANDLE ChildImageHandle,
IN CONST XStringArray& LoadOptions, IN CONST CHAR16 *LoadOptionsPrefix,
IN CONST XString8Array& LoadOptions, IN CONST CHAR16 *LoadOptionsPrefix,
IN CONST XStringW& ImageTitle,
OUT UINTN *ErrorInStep)
{
@ -312,7 +312,7 @@ static EFI_STATUS LoadEFIImage(IN EFI_DEVICE_PATH *DevicePath,
static EFI_STATUS StartEFIImage(IN EFI_DEVICE_PATH *DevicePath,
IN CONST XStringArray& LoadOptions, IN CONST CHAR16 *LoadOptionsPrefix,
IN CONST XString8Array& LoadOptions, IN CONST CHAR16 *LoadOptionsPrefix,
IN CONST XStringW& ImageTitle,
OUT UINTN *ErrorInStep,
OUT EFI_HANDLE *NewImageHandle)
@ -757,10 +757,10 @@ VOID LOADER_ENTRY::StartLoader()
XString8 KernelLocation;
if (OSVersion && AsciiOSVersionToUint64(OSVersion) <= AsciiOSVersionToUint64("10.9")) {
KernelLocation.SPrintf("\"Kernel=/mach_kernel\"");
KernelLocation.S8Printf("\"Kernel=/mach_kernel\"");
} else {
// used for 10.10, 10.11, and new version.
KernelLocation.SPrintf("\"Kernel=/System/Library/Kernels/kernel\"");
KernelLocation.S8Printf("\"Kernel=/System/Library/Kernels/kernel\"");
}
LoadOptions.AddID(KernelLocation);
}
@ -1166,7 +1166,7 @@ static VOID ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne
snwprintf(FileName, 512, "%ls\\%ls", Path, DirEntry->FileName);
Status = StartEFIImage(FileDevicePath(SelfLoadedImage->DeviceHandle, FileName),
NullXStringArray, DirEntry->FileName, XStringW().takeValueFrom(DirEntry->FileName), NULL, &DriverHandle);
NullXString8Array, DirEntry->FileName, XStringW().takeValueFrom(DirEntry->FileName), NULL, &DriverHandle);
if (EFI_ERROR(Status)) {
continue;
}
@ -2332,7 +2332,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
//now it is a time to set RtVariables
SetVariablesFromNvram();
XStringArray TmpArgs = Split<XStringArray>(gSettings.BootArgs, " ");
XString8Array TmpArgs = Split<XString8Array>(gSettings.BootArgs, " ");
DBG("after NVRAM boot-args=%s\n", gSettings.BootArgs);
gSettings.OptionsBits = EncodeOptions(TmpArgs);
// DBG("initial OptionsBits %X\n", gSettings.OptionsBits);