mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-01 22:41:28 +01:00
Disable assign & ctor with char* and wchar_t* parameter.
This commit is contained in:
parent
e602853ba3
commit
51711c1004
@ -16,17 +16,15 @@
|
||||
9A0B085C2402FF8B00E2B470 /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */; };
|
||||
9A0B085E240300E000E2B470 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
|
||||
9A0B085F240308E400E2B470 /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08482402FE9300E2B470 /* XStringW.cpp */; };
|
||||
9A0B08662403144C00E2B470 /* global1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global1.cpp */; };
|
||||
9A0B08672403144C00E2B470 /* global2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08652403144C00E2B470 /* global2.cpp */; };
|
||||
9A0B08662403144C00E2B470 /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A0B086D24039FE700E2B470 /* printf_lite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B086B24039FE700E2B470 /* printf_lite.cpp */; };
|
||||
9A0B08732403B08400E2B470 /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */; };
|
||||
9A0B08742403B08400E2B470 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
|
||||
9A0B08752403B08400E2B470 /* printf_lite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B086B24039FE700E2B470 /* printf_lite.cpp */; };
|
||||
9A0B08772403B08400E2B470 /* XStringWArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08472402FE9300E2B470 /* XStringWArray.cpp */; };
|
||||
9A0B08782403B08400E2B470 /* global2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08652403144C00E2B470 /* global2.cpp */; };
|
||||
9A0B08792403B08400E2B470 /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08482402FE9300E2B470 /* XStringW.cpp */; };
|
||||
9A0B087A2403B08400E2B470 /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A0B087B2403B08400E2B470 /* global1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global1.cpp */; };
|
||||
9A0B087B2403B08400E2B470 /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A0B087C2403B08400E2B470 /* XToolsCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */; };
|
||||
9A0B087D2403B08400E2B470 /* XStringWArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B084F2402FE9B00E2B470 /* XStringWArray_test.cpp */; };
|
||||
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
|
||||
@ -35,6 +33,8 @@
|
||||
9A9223312402FD1000483CBA /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
|
||||
9AA05BB7240FC78D008EA4F8 /* utf8Conversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA05BB6240FC78D008EA4F8 /* utf8Conversion.cpp */; };
|
||||
9AA05BB8240FC78D008EA4F8 /* utf8Conversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA05BB6240FC78D008EA4F8 /* utf8Conversion.cpp */; };
|
||||
9AC780AE2417DD2F005CDD5C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780A32417DD2F005CDD5C /* panic.cpp */; };
|
||||
9AC780AF2417DD2F005CDD5C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780A32417DD2F005CDD5C /* panic.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -78,8 +78,7 @@
|
||||
9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XStringW_test.cpp; sourceTree = "<group>"; };
|
||||
9A0B085D240300E000E2B470 /* Platform.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Platform.cpp; sourceTree = "<group>"; };
|
||||
9A0B08632403132300E2B470 /* XStringW_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringW_test.h; sourceTree = "<group>"; };
|
||||
9A0B08642403144C00E2B470 /* global1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global1.cpp; sourceTree = "<group>"; };
|
||||
9A0B08652403144C00E2B470 /* global2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global2.cpp; sourceTree = "<group>"; };
|
||||
9A0B08642403144C00E2B470 /* global_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global_test.cpp; sourceTree = "<group>"; };
|
||||
9A0B086B24039FE700E2B470 /* printf_lite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = printf_lite.cpp; path = "../../../../../Embedded/Shared/printf_lite-master/printf_lite.cpp"; sourceTree = "<group>"; };
|
||||
9A0B086C24039FE700E2B470 /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = printf_lite.h; path = "../../../../../Embedded/Shared/printf_lite-master/printf_lite.h"; sourceTree = "<group>"; };
|
||||
9A0B08862403B08400E2B470 /* cpp_tests UTF32 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@ -88,6 +87,8 @@
|
||||
9A92234D2402FD9500483CBA /* Platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
|
||||
9AA05BB6240FC78D008EA4F8 /* utf8Conversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = utf8Conversion.cpp; sourceTree = "<group>"; };
|
||||
9AA05BB9240FC796008EA4F8 /* utf8Conversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf8Conversion.h; sourceTree = "<group>"; };
|
||||
9AC780A32417DD2F005CDD5C /* panic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = panic.cpp; sourceTree = "<group>"; };
|
||||
9AC780A62417DD2F005CDD5C /* panic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = panic.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -131,8 +132,7 @@
|
||||
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A0B08642403144C00E2B470 /* global1.cpp */,
|
||||
9A0B08652403144C00E2B470 /* global2.cpp */,
|
||||
9A0B08642403144C00E2B470 /* global_test.cpp */,
|
||||
9A0B08542402FE9B00E2B470 /* all_tests.h */,
|
||||
9A0B08512402FE9B00E2B470 /* all_tests.cpp */,
|
||||
9A0B08632403132300E2B470 /* XStringW_test.h */,
|
||||
@ -154,6 +154,7 @@
|
||||
9A0B08432402FE9300E2B470 /* cpp_foundation */,
|
||||
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */,
|
||||
9A92232F2402FD1000483CBA /* cpp_tests */,
|
||||
9AC7809C2417DD2F005CDD5C /* cpp_util */,
|
||||
9A92232E2402FD1000483CBA /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@ -178,6 +179,16 @@
|
||||
path = src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9AC7809C2417DD2F005CDD5C /* cpp_util */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AC780A32417DD2F005CDD5C /* panic.cpp */,
|
||||
9AC780A62417DD2F005CDD5C /* panic.h */,
|
||||
);
|
||||
name = cpp_util;
|
||||
path = ../../rEFIt_UEFI/cpp_util;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -257,10 +268,10 @@
|
||||
9A0B08752403B08400E2B470 /* printf_lite.cpp in Sources */,
|
||||
9A0B08772403B08400E2B470 /* XStringWArray.cpp in Sources */,
|
||||
9AA05BB8240FC78D008EA4F8 /* utf8Conversion.cpp in Sources */,
|
||||
9A0B08782403B08400E2B470 /* global2.cpp in Sources */,
|
||||
9AC780AF2417DD2F005CDD5C /* panic.cpp in Sources */,
|
||||
9A0B08792403B08400E2B470 /* XStringW.cpp in Sources */,
|
||||
9A0B087A2403B08400E2B470 /* all_tests.cpp in Sources */,
|
||||
9A0B087B2403B08400E2B470 /* global1.cpp in Sources */,
|
||||
9A0B087B2403B08400E2B470 /* global_test.cpp in Sources */,
|
||||
9A0B087C2403B08400E2B470 /* XToolsCommon.cpp in Sources */,
|
||||
9A0B087D2403B08400E2B470 /* XStringWArray_test.cpp in Sources */,
|
||||
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */,
|
||||
@ -278,10 +289,10 @@
|
||||
9A0B086D24039FE700E2B470 /* printf_lite.cpp in Sources */,
|
||||
9A0B08562402FF7700E2B470 /* XStringWArray.cpp in Sources */,
|
||||
9AA05BB7240FC78D008EA4F8 /* utf8Conversion.cpp in Sources */,
|
||||
9A0B08672403144C00E2B470 /* global2.cpp in Sources */,
|
||||
9AC780AE2417DD2F005CDD5C /* panic.cpp in Sources */,
|
||||
9A0B085F240308E400E2B470 /* XStringW.cpp in Sources */,
|
||||
9A0B08592402FF8200E2B470 /* all_tests.cpp in Sources */,
|
||||
9A0B08662403144C00E2B470 /* global1.cpp in Sources */,
|
||||
9A0B08662403144C00E2B470 /* global_test.cpp in Sources */,
|
||||
9A0B08572402FF7A00E2B470 /* XToolsCommon.cpp in Sources */,
|
||||
9A0B08582402FF7F00E2B470 /* XStringWArray_test.cpp in Sources */,
|
||||
9A0B085B2402FF8700E2B470 /* XArray_tests.cpp in Sources */,
|
||||
@ -350,10 +361,7 @@
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
JIEF_DEBUG,
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
@ -413,6 +421,7 @@
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
@ -436,6 +445,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = JIEF_DEBUG;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
void CpuDeadLoop(void)
|
||||
{
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void DebugLog(int DebugMode, const char *FormatString, ...)
|
||||
|
@ -85,7 +85,7 @@ extern "C" {
|
||||
|
||||
// cpp_foundation objects has to be included before lib.h
|
||||
#ifdef __cplusplus
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XStringWP.h"
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
#include "../cpp_util/remove_ref.h"
|
||||
|
@ -56,34 +56,60 @@ DBG("Constructor(const XStringW &aString) : %s\n", aString.data());
|
||||
Init(aString.length());
|
||||
StrnCpy(aString.data(), aString.length());
|
||||
}
|
||||
//
|
||||
//XStringW::XStringW(const wchar_t *S)
|
||||
//{
|
||||
// if ( !S ) {
|
||||
// DebugLog(2, "XStringW(const wchar_t *S) called with NULL. Use setEmpty()\n");
|
||||
// panic();
|
||||
// }
|
||||
//DBG("Constructor(const wchar_t *S) : %s, StrLen(S)=%d\n", S, StrLen(S));
|
||||
// Init(StrLen(S));
|
||||
// StrCpy(S);
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const wchar_t *S, UINTN count)
|
||||
//{
|
||||
//DBG("Constructor(const wchar_t *S, UINTN count) : %s, %d\n", S, count);
|
||||
// Init(count);
|
||||
// StrnCpy(S, count);
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const wchar_t aChar)
|
||||
//{
|
||||
//DBG("Constructor(const wchar_t aChar)\n");
|
||||
// Init(1);
|
||||
// StrnCpy(&aChar, 1);
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const char* S)
|
||||
//{
|
||||
//DBG("Constructor(const char* S)\n");
|
||||
// xsize newLen = StrLenInWChar(S, AsciiStrLen(S));
|
||||
// Init(newLen);
|
||||
// utf8ToWChar(m_data, m_allocatedSize+1, S, AsciiStrLen(S)); // m_size doesn't count the NULL terminator
|
||||
// SetLength(newLen);
|
||||
//}
|
||||
|
||||
XStringW::XStringW(const wchar_t *S)
|
||||
const XStringW& XStringW::takeValueFrom(const wchar_t* S)
|
||||
{
|
||||
DBG("Constructor(const wchar_t *S) : %s, StrLen(S)=%d\n", S, StrLen(S));
|
||||
if ( !S ) {
|
||||
DebugLog(2, "takeValueFrom(const wchar_t* S) called with NULL. Use setEmpty()\n");
|
||||
panic();
|
||||
}
|
||||
Init(StrLen(S));
|
||||
if ( S ) StrCpy(S);
|
||||
StrCpy(S);
|
||||
return *this;
|
||||
}
|
||||
|
||||
XStringW::XStringW(const wchar_t *S, UINTN count)
|
||||
const XStringW& XStringW::takeValueFrom(const char* S)
|
||||
{
|
||||
DBG("Constructor(const wchar_t *S, UINTN count) : %s, %d\n", S, count);
|
||||
Init(count);
|
||||
StrnCpy(S, count);
|
||||
}
|
||||
|
||||
XStringW::XStringW(const wchar_t aChar)
|
||||
{
|
||||
DBG("Constructor(const wchar_t aChar)\n");
|
||||
Init(1);
|
||||
StrnCpy(&aChar, 1);
|
||||
}
|
||||
|
||||
XStringW::XStringW(const char* S)
|
||||
{
|
||||
DBG("Constructor(const char* S)\n");
|
||||
xsize newLen = StrLenInWChar(S, AsciiStrLen(S));
|
||||
UINTN asciiStrLen = AsciiStrLen(S);
|
||||
xsize newLen = StrLenInWChar(S, asciiStrLen);
|
||||
Init(newLen);
|
||||
utf8ToWChar(m_data, m_allocatedSize+1, S, AsciiStrLen(S)); // m_size doesn't count the NULL terminator
|
||||
utf8ToWChar(m_data, m_allocatedSize+1, S, asciiStrLen); // m_size doesn't count the NULL terminator
|
||||
SetLength(newLen);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
@ -133,11 +159,15 @@ wchar_t *XStringW::CheckSize(UINTN nNewSize, UINTN nGrowBy)
|
||||
|
||||
void XStringW::StrnCpy(const wchar_t *buf, UINTN len)
|
||||
{
|
||||
UINTN newLen = 0;
|
||||
if ( buf && *buf && len > 0 ) {
|
||||
CheckSize(len, 0);
|
||||
Xmemmove(data(), buf, len*sizeof(wchar_t));
|
||||
while ( *buf && newLen < len ) {
|
||||
m_data[newLen++] = *buf++;
|
||||
}
|
||||
// Xmemmove(data(), buf, len*sizeof(wchar_t));
|
||||
}
|
||||
SetLength(len); /* data()[len]=0 done in SetLength */
|
||||
SetLength(newLen); /* data()[len]=0 done in SetLength */
|
||||
}
|
||||
|
||||
void XStringW::StrCpy(const wchar_t *buf)
|
||||
@ -281,7 +311,9 @@ XStringW XStringW::dirname() const
|
||||
XStringW XStringW::SubString(UINTN pos, UINTN count) const
|
||||
{
|
||||
if ( count > length()-pos ) count = length()-pos;
|
||||
return XStringW( &(data()[pos]), count);
|
||||
XStringW ret;
|
||||
ret.StrnCat(&(data()[pos]), count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINTN XStringW::IdxOf(wchar_t aChar, UINTN Pos) const
|
||||
@ -424,13 +456,6 @@ void XStringW::RemoveLastEspCtrl()
|
||||
//
|
||||
//*************************************************************************************************
|
||||
|
||||
const XStringW &XStringW::operator =(wchar_t aChar)
|
||||
{
|
||||
//TRACE("Operator =wchar_t \n");
|
||||
StrnCpy(&aChar, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
const XStringW &XStringW::operator =(const XStringW &aString)
|
||||
{
|
||||
//TRACE("Operator =const XStringW&\n");
|
||||
@ -438,16 +463,24 @@ const XStringW &XStringW::operator =(const XStringW &aString)
|
||||
return *this;
|
||||
}
|
||||
|
||||
const XStringW &XStringW::operator =(const wchar_t *S)
|
||||
{
|
||||
//TRACE("Operator =const wchar_t *\n");
|
||||
if ( S == NULL ) {
|
||||
DBG("operator =(const wchar_t *S) called with NULL\n");
|
||||
panic();
|
||||
}
|
||||
StrCpy(S);
|
||||
return *this;
|
||||
}
|
||||
//
|
||||
//const XStringW &XStringW::operator =(wchar_t aChar)
|
||||
//{
|
||||
////TRACE("Operator =wchar_t \n");
|
||||
// StrnCpy(&aChar, 1);
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
//const XStringW &XStringW::operator =(const wchar_t *S)
|
||||
//{
|
||||
////TRACE("Operator =const wchar_t *\n");
|
||||
// if ( S == NULL ) {
|
||||
// DBG("operator =(const wchar_t *S) called with NULL\n");
|
||||
// panic();
|
||||
// }
|
||||
// StrCpy(S);
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@ -498,7 +531,10 @@ XStringW SPrintf(const char* format, ...)
|
||||
XStringW SubString(const wchar_t *S, UINTN pos, UINTN count)
|
||||
{
|
||||
if ( StrLen(S)-pos < count ) count = StrLen(S)-pos;
|
||||
return ( XStringW(S+pos, count) );
|
||||
XStringW ret;
|
||||
ret.StrnCpy(S+pos, count);
|
||||
// return ( XStringW(S+pos, count) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,11 +28,10 @@ public:
|
||||
void Init(UINTN aSize=0);
|
||||
XStringW();
|
||||
XStringW(const XStringW &aString);
|
||||
XStringW(const wchar_t *);
|
||||
XStringW(const wchar_t* S, UINTN count);
|
||||
XStringW(const wchar_t);
|
||||
|
||||
XStringW(const char*);
|
||||
// XStringW(const wchar_t *);
|
||||
// XStringW(const wchar_t* S, UINTN count);
|
||||
// XStringW(const wchar_t);
|
||||
// XStringW(const char*);
|
||||
|
||||
~XStringW();
|
||||
|
||||
@ -99,8 +98,11 @@ public:
|
||||
|
||||
|
||||
const XStringW &operator =(const XStringW &aString);
|
||||
const XStringW &operator =(const wchar_t* S);
|
||||
const XStringW &operator =(wchar_t);
|
||||
// const XStringW &operator =(const wchar_t* S) {fdsf};
|
||||
// const XStringW &operator =(wchar_t);
|
||||
|
||||
const XStringW& takeValueFrom(const wchar_t* S);
|
||||
const XStringW& takeValueFrom(const char* S);
|
||||
|
||||
const XStringW &operator += (const XStringW &);
|
||||
const XStringW &operator += (const wchar_t* S);
|
||||
@ -146,7 +148,7 @@ public:
|
||||
friend XStringW operator + (const XStringW& p1, const XStringW& p2) { XStringW s; s=p1; s+=p2; return s; }
|
||||
// with const wchar_t
|
||||
friend XStringW operator + (const XStringW& p1, const wchar_t *p2 ) { XStringW s; s=p1; s+=p2; return s; }
|
||||
friend XStringW operator + (const wchar_t *p1, const XStringW& p2) { XStringW s; s=p1; s+=p2; return s; }
|
||||
friend XStringW operator + (const wchar_t *p1, const XStringW& p2) { XStringW s; s.StrCat(p1); s.StrCat(p2); return s; }
|
||||
// // with wchar_t
|
||||
// friend XStringW operator + (const XStringW& p1, wchar_t p2 ) { XStringW s; s=p1; s+=p2; return s; }
|
||||
// friend XStringW operator + (wchar_t p1, const XStringW& p2 ) { XStringW s; s=p1; s+=p2; return s; }
|
||||
|
@ -26,11 +26,17 @@ void XStringWArray::AddStrings(const wchar_t *Val1, ...)
|
||||
VA_LIST va;
|
||||
const wchar_t *p;
|
||||
|
||||
AddCopy(Val1);
|
||||
{
|
||||
XStringW* newS = new XStringW;
|
||||
newS->takeValueFrom(Val1);
|
||||
AddReference(newS, true);
|
||||
}
|
||||
VA_START(va, Val1);
|
||||
p = VA_ARG(va, const wchar_t *);
|
||||
while ( p != nullptr ) {
|
||||
AddCopy(p);
|
||||
XStringW* newS = new XStringW;
|
||||
newS->takeValueFrom(Val1);
|
||||
AddReference(newS, true);
|
||||
p = VA_ARG(va, const wchar_t *);
|
||||
}
|
||||
VA_END(va);
|
||||
|
@ -12,11 +12,13 @@
|
||||
#include "XToolsCommon.h"
|
||||
#include "XObjArray.h"
|
||||
#include "XStringW.h"
|
||||
#include "XStringWP.h"
|
||||
|
||||
|
||||
#define XStringWArraySuper XObjArray<XStringW>
|
||||
class XStringWArray : public XStringWArraySuper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
XStringWArray();
|
||||
@ -26,7 +28,7 @@ class XStringWArray : public XStringWArraySuper
|
||||
bool IsNull() const { return size() == 0 ; }
|
||||
bool NotNull() const { return size() > 0 ; }
|
||||
|
||||
XStringW ConcatAll(XStringW Separator = L", ", XStringW Prefix = L"", XStringW Suffix = L"") const;
|
||||
XStringW ConcatAll(XStringW Separator = XStringWP(L", "), XStringW Prefix = XStringWP(L""), XStringW Suffix = XStringWP(L"")) const;
|
||||
|
||||
bool Equal(const XStringWArray &aStrings) const;
|
||||
bool operator ==(const XStringWArray &aXStrings) const { return Equal(aXStrings); }
|
||||
@ -48,6 +50,6 @@ class XStringWArray : public XStringWArraySuper
|
||||
};
|
||||
|
||||
extern const XStringWArray NullXStringws;
|
||||
XStringWArray Split(const XStringW &S, const XStringW &Separator = L", ");
|
||||
XStringWArray Split(const XStringW &S, const XStringW &Separator = XStringWP(L", "));
|
||||
|
||||
#endif
|
||||
|
67
rEFIt_UEFI/cpp_foundation/XStringWP.cpp
Executable file
67
rEFIt_UEFI/cpp_foundation/XStringWP.cpp
Executable file
@ -0,0 +1,67 @@
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// STRING
|
||||
//
|
||||
// Developed by jief666, from 1997.
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
|
||||
#if !defined(__XStringW_CPP__)
|
||||
#define __XStringW_CPP__
|
||||
|
||||
#if 0
|
||||
#define DBG(...) DebugLog(2, __VA_ARGS__)
|
||||
#else
|
||||
#define DBG(...)
|
||||
#endif
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "XStringWP.h"
|
||||
|
||||
#include "printf_lite.h"
|
||||
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Constructor
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
|
||||
XStringWP::XStringWP(const wchar_t *S)
|
||||
{
|
||||
if ( !S ) {
|
||||
DebugLog(2, "XStringWP(const wchar_t *S) called with NULL. Use setEmpty()\n");
|
||||
panic();
|
||||
}
|
||||
DBG("Constructor(const wchar_t *S) : %s, StrLen(S)=%d\n", S, StrLen(S));
|
||||
Init(StrLen(S));
|
||||
StrCpy(S);
|
||||
}
|
||||
|
||||
//XStringW::XStringW(const wchar_t *S, UINTN count)
|
||||
//{
|
||||
//DBG("Constructor(const wchar_t *S, UINTN count) : %s, %d\n", S, count);
|
||||
// Init(count);
|
||||
// StrnCpy(S, count);
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const wchar_t aChar)
|
||||
//{
|
||||
//DBG("Constructor(const wchar_t aChar)\n");
|
||||
// Init(1);
|
||||
// StrnCpy(&aChar, 1);
|
||||
//}
|
||||
|
||||
XStringWP::XStringWP(const char* S)
|
||||
{
|
||||
DBG("Constructor(const char* S)\n");
|
||||
xsize newLen = StrLenInWChar(S, AsciiStrLen(S));
|
||||
Init(newLen);
|
||||
utf8ToWChar(m_data, m_allocatedSize+1, S, AsciiStrLen(S)); // m_size doesn't count the NULL terminator
|
||||
SetLength(newLen);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
37
rEFIt_UEFI/cpp_foundation/XStringWP.h
Executable file
37
rEFIt_UEFI/cpp_foundation/XStringWP.h
Executable file
@ -0,0 +1,37 @@
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// STRING
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
#if !defined(__XStringWP_H__)
|
||||
#define __XStringWP_H__
|
||||
|
||||
#include "XStringWP.h"
|
||||
#include "XStringW.h"
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "utf8Conversion.h"
|
||||
|
||||
#define XStringWP_super XStringW
|
||||
class XStringWP : public XStringWP_super
|
||||
{
|
||||
protected:
|
||||
// wchar_t *m_data;
|
||||
|
||||
public:
|
||||
XStringWP() : XStringWP_super() {};
|
||||
XStringWP(const wchar_t *);
|
||||
// XStringWP(const wchar_t* S, UINTN count);
|
||||
// XStringWP(const wchar_t);
|
||||
XStringWP(const char*);
|
||||
|
||||
// ~XStringWP();
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -13,10 +13,10 @@ extern xsize XBufferGrowByDefault;
|
||||
*/
|
||||
#define __XTOOLS_INT_CHECK__
|
||||
|
||||
#ifdef CLOVER_BUILD
|
||||
|
||||
#include "../cpp_util/panic.h"
|
||||
|
||||
#ifdef CLOVER_BUILD
|
||||
|
||||
extern "C" {
|
||||
#include <Library/BaseLib.h> // for StrCmp
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
@ -99,9 +99,9 @@ size_t StrLenInWChar(const char *s, size_t src_len)
|
||||
|
||||
|
||||
|
||||
void utf8ToWChar(wchar_t* dst, size_t dst_max_len, const char *s, size_t src_len)
|
||||
size_t utf8ToWChar(wchar_t* dst, size_t dst_max_len, const char *s, size_t src_len)
|
||||
{
|
||||
if ( dst_max_len == 0 ) return;
|
||||
if ( dst_max_len == 0 ) return 0;
|
||||
dst_max_len -= 1;
|
||||
|
||||
size_t dst_len = 0;
|
||||
@ -177,6 +177,7 @@ void utf8ToWChar(wchar_t* dst, size_t dst_max_len, const char *s, size_t src_le
|
||||
}
|
||||
exit:
|
||||
dst[dst_len] = 0;
|
||||
return dst_len;
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,6 +9,6 @@
|
||||
|
||||
|
||||
UINTN StrLenInWChar(const char *src, UINTN src_len);
|
||||
void utf8ToWChar(wchar_t* dst, UINTN dst_max_len, const char *s, UINTN src_len);
|
||||
UINTN utf8ToWChar(wchar_t* dst, UINTN dst_max_len, const char *s, UINTN src_len);
|
||||
|
||||
#endif /* utf816Conversion_hpp */
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XStringWArray.h"
|
||||
#include "../cpp_foundation/XStringWP.h"
|
||||
|
||||
int XStringWArray_tests()
|
||||
{
|
||||
@ -12,20 +13,20 @@ int XStringWArray_tests()
|
||||
|
||||
if ( !array1.IsNull() ) return 1;
|
||||
|
||||
array1.Add(L"1");
|
||||
array1.Add(XStringWP(L"1"));
|
||||
if ( array1.IsNull() ) return 2;
|
||||
array1.Add(L"2");
|
||||
array1.Add(XStringWP(L"2"));
|
||||
|
||||
if ( array1[0] != L"1" ) return 3;
|
||||
if ( array1[1] != L"2" ) return 4;
|
||||
|
||||
if ( !array1.Contains(L"2") ) return 5;
|
||||
if ( !array1.Contains(XStringWP(L"2")) ) return 5;
|
||||
|
||||
// Test == and !=
|
||||
{
|
||||
XStringWArray array1bis;
|
||||
array1bis.Add(L"1");
|
||||
array1bis.Add(L"2");
|
||||
array1bis.Add(XStringWP(L"1"));
|
||||
array1bis.Add(XStringWP(L"2"));
|
||||
|
||||
if ( !(array1 == array1bis) ) return 10;
|
||||
if ( array1 != array1bis ) return 11;
|
||||
@ -33,19 +34,19 @@ int XStringWArray_tests()
|
||||
|
||||
// Test concat and Split
|
||||
{
|
||||
XStringW c = array1.ConcatAll(L", ", L"^", L"$");
|
||||
XStringW c = array1.ConcatAll(XStringWP(L", "), XStringWP(L"^"), XStringWP(L"$"));
|
||||
if ( c != L"^1, 2$" ) return 1;
|
||||
|
||||
// Split doesn't handle prefix and suffix yet.
|
||||
c = array1.ConcatAll(L", ");
|
||||
c = array1.ConcatAll(XStringWP(L", "));
|
||||
|
||||
XStringWArray array1bis = Split(c);
|
||||
if ( array1 != array1bis ) return 20;
|
||||
}
|
||||
|
||||
XStringWArray array2;
|
||||
array2.Add(L"2");
|
||||
array2.Add(L"1");
|
||||
array2.Add(XStringWP(L"2"));
|
||||
array2.Add(XStringWP(L"1"));
|
||||
|
||||
if ( array2[0] != L"2" ) return 30;
|
||||
if ( array2[1] != L"1" ) return 31;
|
||||
@ -54,13 +55,13 @@ int XStringWArray_tests()
|
||||
if ( array1 == array2 ) return 40; // Array != because order is different
|
||||
if ( !array1.Same(array2) ) return 41; // Arrays are the same
|
||||
|
||||
array1.AddNoNull(L"3");
|
||||
array1.AddNoNull(XStringWP(L"3"));
|
||||
if ( array1.size() != 3 ) return 50;
|
||||
array1.AddNoNull(L"");
|
||||
array1.AddNoNull(XStringWP(L""));
|
||||
if ( array1.size() != 3 ) return 51;
|
||||
array1.AddEvenNull(XStringW());
|
||||
if ( array1.size() != 4 ) return 52;
|
||||
array1.AddID(L"2");
|
||||
array1.AddID(XStringWP(L"2"));
|
||||
if ( array1.size() != 4 ) return 53;
|
||||
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "global1.h"
|
||||
#include "global2.h"
|
||||
#include "../cpp_foundation/utf8Conversion.h"
|
||||
#include "global_test.h"
|
||||
|
||||
|
||||
//#include <wchar.h>
|
||||
@ -14,15 +13,23 @@ int XStringW_tests()
|
||||
#ifdef JIEF_DEBUG
|
||||
DebugLog(2, "XStringW_tests -> Enter\n");
|
||||
#endif
|
||||
//XStringW a = " ";
|
||||
XStringW b;
|
||||
//b = a;
|
||||
//b = " ";
|
||||
|
||||
if ( global_str1 != L"global_str1" ) return 1;
|
||||
if ( global_str2 != L"global_str2" ) return 2;
|
||||
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
XStringW str(L"1");
|
||||
if ( str != L"1" ) return 3;
|
||||
str.StrCat(L"2");
|
||||
if ( str != L"12" ) return 4;
|
||||
#endif
|
||||
|
||||
XStringW str;
|
||||
str.takeValueFrom(L"12");
|
||||
XStringW str2;
|
||||
if ( !str2.isEmpty() ) return 10;
|
||||
str2.StrnCpy(str.data(), 2);
|
||||
@ -40,7 +47,7 @@ int XStringW_tests()
|
||||
|
||||
str2.SPrintf("%c", 'a'); // signle UTF8 ascii char
|
||||
if ( str2 != L"a" ) return 20;
|
||||
str2.SPrintf("%ls", L"ab"); // UTF16(32) string containing ascii char
|
||||
str2.takeValueFrom(L"ab"); // UTF16(32) string containing ascii char
|
||||
if ( str2 != L"ab" ) return 21;
|
||||
#ifdef _MSC_VER
|
||||
// IMPORTANT : you can't pass a litteral char in a vararg function with Visual Studio (Microsoft strikes again :-).
|
||||
@ -56,22 +63,26 @@ int XStringW_tests()
|
||||
|
||||
str2.SPrintf("%lc", c); // UTF16(32) char. (2 bytes in total if UTF16)
|
||||
if (str2 != s) return 22;
|
||||
str2.SPrintf("%s", "");
|
||||
str2.takeValueFrom("");
|
||||
if (str2.length() != 0) return 221;
|
||||
str2.SPrintf("%ls", s); // this is a UTF8 string 2 bytes long
|
||||
str2.takeValueFrom(s); // this is a UTF8 string 2 bytes long
|
||||
if (str2 != s) return 23;
|
||||
#else
|
||||
str2.SPrintf("%lc", L'Ň'); // signe UTF16(32) char. (2 bytes in total if UTF16)
|
||||
if ( str2 != L"Ň" ) return 22;
|
||||
str2.SPrintf("%s", "");
|
||||
str2.takeValueFrom("");
|
||||
if (str2.length() != 0) return 221;
|
||||
str2.SPrintf("%s", "Ň"); // this is a UTF8 string 2 bytes long
|
||||
if (str2 != "Ň") return 23;
|
||||
str2.SPrintf("%s", "");
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
str2.takeValueFrom("Ň"); // this is a UTF8 string 2 bytes long
|
||||
if (str2 != "Ň") return 23; // utf8 litteral are converted to an XStringW if ctor is available.
|
||||
#endif
|
||||
str2.takeValueFrom("");
|
||||
if (str2.length() != 0) return 231;
|
||||
str2.SPrintf("%ls", L"Ň"); // this is a UTF8 string 2 bytes long
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
str2.takeValueFrom(L"Ň"); // this is a UTF8 string 2 bytes long
|
||||
if (str2 != "Ň") return 24;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __WCHAR_MAX__ > 0xFFFFu
|
||||
str2.SPrintf("%lc", L'𐌾'); // L'𐌾' // this char cannot convert to an UTF16 char. So it doesn't compile with -fshort-wchar
|
||||
@ -82,11 +93,12 @@ int XStringW_tests()
|
||||
#ifndef _MSC_VER
|
||||
// "𐌾" in UTF16 is 2 char : 0xd800, 0xdf3e
|
||||
|
||||
str2.SPrintf("%ls", L"𐌾"); // this is a UTF8 string 4 bytes long
|
||||
str2.takeValueFrom(L"𐌾"); // this is a UTF8 string 4 bytes long
|
||||
if ( str2 != L"𐌾" ) return 31;
|
||||
str2.SPrintf("%ls", L"𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar)
|
||||
str2.takeValueFrom(L"𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar)
|
||||
if ( str2 != L"𐌾" ) return 32;
|
||||
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
{
|
||||
XStringW str3("a");
|
||||
if ( str3 != L"a" ) return 40;
|
||||
@ -94,6 +106,7 @@ int XStringW_tests()
|
||||
if ( str4 != L"aŇ𐌾" ) return 41;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot");
|
||||
// for (UINTN Index = 0; Index < 20; Index++) {
|
||||
|
@ -1,3 +0,0 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
XStringW global_str1(L"global_str1");
|
@ -1,3 +0,0 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
XStringW global_str2(L"global_str2");
|
@ -1,3 +0,0 @@
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
|
||||
extern XStringW global_str2;
|
14
rEFIt_UEFI/cpp_unit_test/global_test.cpp
Normal file
14
rEFIt_UEFI/cpp_unit_test/global_test.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
|
||||
class XStringWTest : public XStringW
|
||||
{
|
||||
public:
|
||||
XStringWTest(const wchar_t *S) : XStringW()
|
||||
{
|
||||
StrCpy(S);
|
||||
}
|
||||
};
|
||||
|
||||
XStringWTest global_str1(L"global_str1");
|
||||
XStringWTest global_str2(L"global_str2");
|
@ -1,3 +1,4 @@
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
|
||||
extern XStringW global_str1;
|
||||
extern XStringW global_str2;
|
@ -1,9 +1,9 @@
|
||||
#include "panic.h"
|
||||
#include "../Platform/Platform.h"
|
||||
#include <Platform.h>
|
||||
|
||||
extern "C" {
|
||||
#include <Library/BaseLib.h> // for CpuDeadLoop
|
||||
}
|
||||
//extern "C" {
|
||||
//#include <Library/BaseLib.h> // for CpuDeadLoop
|
||||
//}
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -312,7 +312,9 @@ STATIC void CreateInfoLines(IN CONST CHAR16 *Message, OUT XStringWArray* Informa
|
||||
while ((Index < Total) &&
|
||||
((Ptr2 = (CHAR16*)StrStr(Ptr2, L"\n")) != NULL)) { // cast is ok because FilePath is not const, and we know that StrStr returns a pointer in FilePath. Will disappear when using a string object instead of CHAR16*
|
||||
*Ptr2++ = 0;
|
||||
Information->Add(XStringW(Ptr2));
|
||||
XStringW* s = new XStringW;
|
||||
s->takeValueFrom(Ptr2);
|
||||
Information->AddReference(s, true);
|
||||
// Information[Index++] = Ptr2;
|
||||
}
|
||||
// // Return the info lines
|
||||
@ -354,8 +356,8 @@ VOID AlertMessage(IN CONST CHAR16 *Title, IN CONST CHAR16 *Message)
|
||||
#define TAG_NO 2
|
||||
|
||||
//REFIT_SIMPLE_MENU_ENTRY_TAG(CONST CHAR16 *Title_, UINTN Tag_, ACTION AtClick_)
|
||||
STATIC REFIT_SIMPLE_MENU_ENTRY_TAG YesMessageEntry = { L"Yes", TAG_YES, ActionEnter };
|
||||
STATIC REFIT_SIMPLE_MENU_ENTRY_TAG NoMessageEntry = { L"No", TAG_NO, ActionEnter };
|
||||
STATIC REFIT_SIMPLE_MENU_ENTRY_TAG YesMessageEntry = { XStringWP(L"Yes"), TAG_YES, ActionEnter };
|
||||
STATIC REFIT_SIMPLE_MENU_ENTRY_TAG NoMessageEntry = { XStringWP(L"No"), TAG_NO, ActionEnter };
|
||||
|
||||
//REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
|
||||
STATIC REFIT_MENU_SCREEN YesNoMessageMenu(0, NULL, NULL, &YesMessageEntry, &NoMessageEntry);
|
||||
@ -435,7 +437,7 @@ BOOLEAN AskUserForFilePathFromVolumes(IN CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_
|
||||
((Volume->DevicePathString == NULL) && (Volume->VolName == NULL))) {
|
||||
continue;
|
||||
}
|
||||
REFIT_SIMPLE_MENU_ENTRY_TAG *Entry = new REFIT_SIMPLE_MENU_ENTRY_TAG((Volume->VolName == NULL) ? Volume->DevicePathString : Volume->VolName, TAG_OFFSET + Index, MENU_EXIT_ENTER);
|
||||
REFIT_SIMPLE_MENU_ENTRY_TAG *Entry = new REFIT_SIMPLE_MENU_ENTRY_TAG(XStringWP((Volume->VolName == NULL) ? Volume->DevicePathString : Volume->VolName), TAG_OFFSET + Index, MENU_EXIT_ENTER);
|
||||
// Entry = Entries[Count++] = EntryPtr++;
|
||||
// Entry->Title = (Volume->VolName == NULL) ? Volume->DevicePathString : Volume->VolName;
|
||||
// Entry->Tag = TAG_OFFSET + Index;
|
||||
|
@ -121,10 +121,10 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LEGACY_ENTRY));
|
||||
Entry = new LEGACY_ENTRY();
|
||||
if (FullTitle) {
|
||||
Entry->Title = EfiStrDuplicate(FullTitle);
|
||||
Entry->Title.takeValueFrom(FullTitle);
|
||||
} else {
|
||||
if (GlobalConfig.BootCampStyle) {
|
||||
Entry->Title.SPrintf("%ls", LoaderTitle);
|
||||
Entry->Title.takeValueFrom(LoaderTitle);
|
||||
} else {
|
||||
Entry->Title.SPrintf("Boot %ls from %ls", LoaderTitle, VolDesc);
|
||||
}
|
||||
@ -166,7 +166,7 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
// default entry
|
||||
// SubEntry = (__typeof__(SubEntry))AllocateZeroPool(sizeof(LEGACY_ENTRY));
|
||||
SubEntry = new LEGACY_ENTRY();
|
||||
SubEntry->Title = PoolPrint(L"Boot %s", LoaderTitle);
|
||||
SubEntry->Title.SPrintf("Boot %ls", LoaderTitle);
|
||||
// SubEntry->Tag = TAG_LEGACY;
|
||||
SubEntry->Volume = Entry->Volume;
|
||||
SubEntry->DevicePathString = Entry->DevicePathString;
|
||||
|
@ -646,7 +646,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
|
||||
|
||||
if (FullTitle) {
|
||||
Entry->Title = FullTitle;
|
||||
Entry->Title.takeValueFrom(FullTitle);
|
||||
}
|
||||
if ( Entry->Title.isEmpty() && Volume->VolLabel != NULL ) {
|
||||
if ( Volume->VolLabel[0] == L'#' ) {
|
||||
@ -659,7 +659,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
if ( Entry->Title.isEmpty() && ((Entry->VolName == NULL) || (StrLen(Entry->VolName) == 0)) ) {
|
||||
//DBG("encounter Entry->VolName ==%s and StrLen(Entry->VolName) ==%d\n",Entry->VolName, StrLen(Entry->VolName));
|
||||
if (GlobalConfig.BootCampStyle) {
|
||||
Entry->Title.SPrintf("%ls", ((LoaderTitle != NULL) ? LoaderTitle : Basename(Volume->DevicePathString)));
|
||||
Entry->Title.takeValueFrom(((LoaderTitle != NULL) ? LoaderTitle : Basename(Volume->DevicePathString)));
|
||||
} else {
|
||||
Entry->Title.SPrintf("Boot %ls from %ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath),
|
||||
Basename(Volume->DevicePathString));
|
||||
@ -669,9 +669,9 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
//DBG("encounter LoaderTitle ==%s and Entry->VolName ==%s\n", LoaderTitle, Entry->VolName);
|
||||
if (GlobalConfig.BootCampStyle) {
|
||||
if ((StriCmp(LoaderTitle, L"macOS") == 0) || (StriCmp(LoaderTitle, L"Recovery") == 0)) {
|
||||
Entry->Title.SPrintf("%ls", Entry->VolName);
|
||||
Entry->Title.takeValueFrom(Entry->VolName);
|
||||
} else {
|
||||
Entry->Title.SPrintf("%ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath));
|
||||
Entry->Title.takeValueFrom((LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath));
|
||||
}
|
||||
} else {
|
||||
Entry->Title.SPrintf("Boot %ls from %ls", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath),
|
||||
@ -784,7 +784,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (OSFLAG_ISSET(Entry->Flags, OSFLAG_HIBERNATED)) {
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = L"Cancel hibernate wake";
|
||||
SubEntry->Title.takeValueFrom("Cancel hibernate wake");
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_HIBERNATED);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
@ -793,11 +793,11 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubEntry->Title = L"Boot Mac OS X with selected options";
|
||||
SubEntry->Title.takeValueFrom("Boot Mac OS X with selected options");
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
SubEntry->Title = L"Boot OS X with selected options";
|
||||
SubEntry->Title.takeValueFrom("Boot OS X with selected options");
|
||||
} else {
|
||||
SubEntry->Title = L"Boot macOS with selected options";
|
||||
SubEntry->Title.takeValueFrom("Boot macOS with selected options");
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
@ -805,11 +805,11 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubEntry->Title = L"Boot Mac OS X with injected kexts";
|
||||
SubEntry->Title.takeValueFrom("Boot Mac OS X with injected kexts");
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
SubEntry->Title = L"Boot OS X with injected kexts";
|
||||
SubEntry->Title.takeValueFrom("Boot OS X with injected kexts");
|
||||
} else {
|
||||
SubEntry->Title = L"Boot macOS with injected kexts";
|
||||
SubEntry->Title.takeValueFrom("Boot macOS with injected kexts");
|
||||
}
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_CHECKFAKESMC);
|
||||
SubEntry->Flags = OSFLAG_SET(SubEntry->Flags, OSFLAG_WITHKEXTS);
|
||||
@ -818,11 +818,11 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubEntry->Title = L"Boot Mac OS X without injected kexts";
|
||||
SubEntry->Title.takeValueFrom("Boot Mac OS X without injected kexts");
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
SubEntry->Title = L"Boot OS X without injected kexts";
|
||||
SubEntry->Title.takeValueFrom("Boot OS X without injected kexts");
|
||||
} else {
|
||||
SubEntry->Title = L"Boot macOS without injected kexts";
|
||||
SubEntry->Title.takeValueFrom("Boot macOS without injected kexts");
|
||||
}
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_CHECKFAKESMC);
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_WITHKEXTS);
|
||||
@ -876,7 +876,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
// default entry
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = PoolPrint(L"Run %s", FileName);
|
||||
SubEntry->Title.SPrintf("Run %ls", FileName);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
@ -884,10 +884,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (SubEntry) {
|
||||
FreePool(SubEntry->LoadOptions);
|
||||
if (Quiet) {
|
||||
SubEntry->Title = PoolPrint(L"%s verbose", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls verbose", Entry->Title.s());
|
||||
SubEntry->LoadOptions = RemoveLoadOption(Entry->LoadOptions, L"quiet");
|
||||
} else {
|
||||
SubEntry->Title = PoolPrint(L"%s quiet", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls quiet", Entry->Title.s());
|
||||
SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"quiet");
|
||||
}
|
||||
}
|
||||
@ -896,10 +896,10 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (SubEntry) {
|
||||
FreePool(SubEntry->LoadOptions);
|
||||
if (WithSplash) {
|
||||
SubEntry->Title = PoolPrint(L"%s without splash", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions = RemoveLoadOption(Entry->LoadOptions, L"splash");
|
||||
} else {
|
||||
SubEntry->Title = PoolPrint(L"%s with splash", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"splash");
|
||||
}
|
||||
}
|
||||
@ -910,22 +910,22 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
if (WithSplash) {
|
||||
if (Quiet) {
|
||||
TempOptions = RemoveLoadOption(Entry->LoadOptions, L"splash");
|
||||
SubEntry->Title = PoolPrint(L"%s verbose without splash", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls verbose without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions = RemoveLoadOption(TempOptions, L"quiet");
|
||||
FreePool(TempOptions);
|
||||
} else {
|
||||
TempOptions = RemoveLoadOption(Entry->LoadOptions, L"splash");
|
||||
SubEntry->Title = PoolPrint(L"%s quiet without splash", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls quiet without splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions = AddLoadOption(TempOptions, L"quiet");
|
||||
FreePool(TempOptions);
|
||||
}
|
||||
} else if (Quiet) {
|
||||
TempOptions = RemoveLoadOption(Entry->LoadOptions, L"quiet");
|
||||
SubEntry->Title = PoolPrint(L"%s verbose with splash", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls verbose with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"splash");
|
||||
FreePool(TempOptions);
|
||||
} else {
|
||||
SubEntry->Title = PoolPrint(L"%s quiet with splash", Entry->Title.s());
|
||||
SubEntry->Title.SPrintf("%ls quiet with splash", Entry->Title.s());
|
||||
SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"quiet splash");
|
||||
}
|
||||
}
|
||||
@ -937,26 +937,26 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
|
||||
// default entry
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = PoolPrint(L"Run %s", FileName);
|
||||
SubEntry->Title.SPrintf("Run %ls", FileName);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = PoolPrint(L"Boot Windows from Hard Disk");
|
||||
SubEntry->Title.takeValueFrom("Boot Windows from Hard Disk");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = PoolPrint(L"Boot Windows from CD-ROM");
|
||||
SubEntry->Title.takeValueFrom("Boot Windows from CD-ROM");
|
||||
SubEntry->LoadOptions = PoolPrint(L"-s -c");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = PoolPrint(L"Run %s in text mode", FileName);
|
||||
SubEntry->Title.SPrintf("Run %ls in text mode", FileName);
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_USEGRAPHICS);
|
||||
SubEntry->LoadOptions = PoolPrint(L"-v");
|
||||
SubEntry->LoaderType = OSTYPE_OTHER; // Sothor - Why are we using OSTYPE_OTHER here?
|
||||
|
@ -441,7 +441,7 @@ BOOLEAN ConfigureSecureBoot(VOID)
|
||||
REFIT_MENU_ENTRY *ChosenEntry = NULL;
|
||||
EFI_DEVICE_PATH *DevicePath = NULL;
|
||||
// Add the entry for secure boot policy
|
||||
SecureBootPolicyEntry.Title = PoolPrint(L"Secure boot policy: %s", SecureBootPolicyToStr(gSettings.SecureBootPolicy));
|
||||
SecureBootPolicyEntry.Title.SPrintf("Secure boot policy: %ls", SecureBootPolicyToStr(gSettings.SecureBootPolicy));
|
||||
if (SecureBootPolicyEntry.Title.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ STATIC BOOLEAN AddToolEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *FullTi
|
||||
}
|
||||
|
||||
if (FullTitle) {
|
||||
Entry->Title = EfiStrDuplicate(FullTitle);
|
||||
Entry->Title.takeValueFrom(FullTitle);
|
||||
} else {
|
||||
Entry->Title.SPrintf("Start %ls", LoaderTitle);
|
||||
}
|
||||
@ -121,9 +121,9 @@ STATIC VOID AddCloverEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *LoaderT
|
||||
// EFI_STATUS Status;
|
||||
|
||||
// prepare the menu entry
|
||||
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(*Entry));
|
||||
// Entry = new REFIT_MENU_ENTRY_CLOVER();
|
||||
Entry->Title = LoaderTitle;
|
||||
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(*Entry));
|
||||
Entry = new REFIT_MENU_ENTRY_CLOVER();
|
||||
Entry->Title.takeValueFrom(LoaderTitle);
|
||||
// Entry->Tag = TAG_CLOVER;
|
||||
Entry->Row = 1;
|
||||
Entry->ShortcutLetter = 'C';
|
||||
@ -158,21 +158,21 @@ STATIC VOID AddCloverEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *LoaderT
|
||||
//always add and always remove menu entries
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = EfiStrDuplicate(L"Add Clover boot options for all entries");
|
||||
SubEntry->Title.SPrintf("Add Clover boot options for all entries");
|
||||
SubEntry->LoadOptions = EfiStrDuplicate(L"BO-ADD");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = EfiStrDuplicate(L"Remove all Clover boot options");
|
||||
SubEntry->Title.SPrintf("Remove all Clover boot options");
|
||||
SubEntry->LoadOptions = EfiStrDuplicate(L"BO-REMOVE");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry = Entry->getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title = EfiStrDuplicate(L"Print all UEFI boot options to log");
|
||||
SubEntry->Title.SPrintf("Print all UEFI boot options to log");
|
||||
SubEntry->LoadOptions = EfiStrDuplicate(L"BO-PRINT");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
@ -131,16 +131,16 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
virtual REFIT_MENU_ENTRY_ITEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return nullptr; };
|
||||
virtual REFIT_MENU_ITEM_BOOTNUM* getREFIT_MENU_ITEM_BOOTNUM() { return nullptr; };
|
||||
|
||||
REFIT_ABSTRACT_MENU_ENTRY() : Title(""), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
||||
REFIT_ABSTRACT_MENU_ENTRY() : Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
||||
{};
|
||||
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
||||
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
||||
{};
|
||||
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, ACTION AtClick_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
||||
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_, ACTION AtClick_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
||||
{};
|
||||
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
: Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_), Image(NULL), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL)
|
||||
{};
|
||||
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, UINTN Row_,
|
||||
REFIT_ABSTRACT_MENU_ENTRY(const XStringW& Title_, UINTN Row_,
|
||||
CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, EG_IMAGE* Image_,
|
||||
EG_RECT Place_, ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
|
||||
REFIT_MENU_SCREEN *SubScreen_)
|
||||
@ -161,7 +161,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
public:
|
||||
UINTN Tag;
|
||||
|
||||
REFIT_SIMPLE_MENU_ENTRY_TAG(CONST CHAR16 *Title_, UINTN Tag_, ACTION AtClick_)
|
||||
REFIT_SIMPLE_MENU_ENTRY_TAG(const XStringW& Title_, UINTN Tag_, ACTION AtClick_)
|
||||
: REFIT_ABSTRACT_MENU_ENTRY(Title_, AtClick_), Tag(Tag_)
|
||||
{};
|
||||
|
||||
@ -176,7 +176,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
{
|
||||
public:
|
||||
REFIT_MENU_ITEM_RETURN() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
||||
REFIT_MENU_ITEM_RETURN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
REFIT_MENU_ITEM_RETURN(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
||||
{};
|
||||
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return this; };
|
||||
@ -186,7 +186,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
{
|
||||
public:
|
||||
REFIT_MENU_ITEM_SHUTDOWN() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
||||
REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
REFIT_MENU_ITEM_SHUTDOWN(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
||||
{};
|
||||
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return this; };
|
||||
@ -195,7 +195,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
class REFIT_MENU_ITEM_RESET : public REFIT_ABSTRACT_MENU_ENTRY {
|
||||
public:
|
||||
REFIT_MENU_ITEM_RESET() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
||||
REFIT_MENU_ITEM_RESET(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
REFIT_MENU_ITEM_RESET(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
||||
{};
|
||||
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return this; };
|
||||
@ -205,7 +205,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
{
|
||||
public:
|
||||
REFIT_MENU_ITEM_ABOUT() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
||||
REFIT_MENU_ITEM_ABOUT(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
REFIT_MENU_ITEM_ABOUT(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
||||
{};
|
||||
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return this; };
|
||||
@ -214,7 +214,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
class REFIT_MENU_ITEM_OPTIONS : public REFIT_ABSTRACT_MENU_ENTRY {
|
||||
public:
|
||||
REFIT_MENU_ITEM_OPTIONS() : REFIT_ABSTRACT_MENU_ENTRY() {};
|
||||
REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
REFIT_MENU_ITEM_OPTIONS(const XStringW& Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, AtClick_)
|
||||
{};
|
||||
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return this; };
|
||||
|
@ -625,7 +625,7 @@ VOID egTakeImage(IN EG_IMAGE *Image, INTN ScreenPosX, INTN ScreenPosY,
|
||||
//
|
||||
// Make a screenshot
|
||||
//
|
||||
CONST CHAR8 ScreenShotName[] = "EFI\\CLOVER\\misc\\screenshot";
|
||||
//CONST CHAR8 ScreenShotName[] = "EFI\\CLOVER\\misc\\screenshot";
|
||||
EFI_STATUS egScreenShot(VOID)
|
||||
{
|
||||
EFI_STATUS Status = EFI_NOT_READY;
|
||||
@ -638,7 +638,7 @@ EFI_STATUS egScreenShot(VOID)
|
||||
UINTN FileDataLength = 0U;
|
||||
Screen.ToPNG(&FileData, FileDataLength);
|
||||
//save file with a first unoccupied name
|
||||
XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot");
|
||||
XStringWP CommonName(L"EFI\\CLOVER\\misc\\screenshot");
|
||||
for (UINTN Index = 0; Index < 60; Index++) {
|
||||
// ScreenshotName = PoolPrint(L"%a%d.png", ScreenShotName, Index);
|
||||
XStringW Name = CommonName + SPrintf("%lld", Index) + L".png";
|
||||
|
@ -192,24 +192,24 @@
|
||||
cpp_foundation/XObjArray.h
|
||||
cpp_foundation/XStringW.cpp
|
||||
cpp_foundation/XStringW.h
|
||||
cpp_foundation/XStringWP.cpp
|
||||
cpp_foundation/XStringWP.h
|
||||
cpp_foundation/XStringWArray.cpp
|
||||
cpp_foundation/XStringWArray.h
|
||||
cpp_foundation/XToolsCommon.cpp
|
||||
cpp_foundation/XToolsCommon.h
|
||||
cpp_unit_test/all_tests.h
|
||||
cpp_unit_test/all_tests.cpp
|
||||
cpp_unit_test/global_test.cpp
|
||||
cpp_unit_test/global_test.h
|
||||
cpp_unit_test/XArray_tests.cpp
|
||||
cpp_unit_test/XArray_tests.h
|
||||
cpp_unit_test/XObjArray_tests.cpp
|
||||
cpp_unit_test/XObjArray_tests.h
|
||||
cpp_unit_test/XStringW_test.cpp
|
||||
cpp_unit_test/all_tests.h
|
||||
cpp_unit_test/global2.cpp
|
||||
cpp_unit_test/XArray_tests.h
|
||||
cpp_unit_test/XStringWArray_test.cpp
|
||||
cpp_unit_test/XStringW_test.h
|
||||
cpp_unit_test/global1.cpp
|
||||
cpp_unit_test/global2.h
|
||||
cpp_unit_test/XObjArray_tests.cpp
|
||||
cpp_unit_test/XStringWArray_test.cpp
|
||||
cpp_unit_test/XStringWArray_test.h
|
||||
cpp_unit_test/all_tests.cpp
|
||||
cpp_unit_test/global1.h
|
||||
[Sources.IA32]
|
||||
libeg/ftol.asm | MSFT
|
||||
|
||||
|
@ -207,11 +207,11 @@ BOOLEAN mGuiReady = FALSE;
|
||||
|
||||
|
||||
//REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
|
||||
REFIT_MENU_ITEM_OPTIONS MenuEntryOptions (L"Options", 1, 0, 'O', ActionEnter);
|
||||
REFIT_MENU_ITEM_ABOUT MenuEntryAbout (L"About Clover", 1, 0, 'A', ActionEnter);
|
||||
REFIT_MENU_ITEM_RESET MenuEntryReset (L"Restart Computer", 1, 0, 'R', ActionSelect);
|
||||
REFIT_MENU_ITEM_SHUTDOWN MenuEntryShutdown(L"Exit Clover", 1, 0, 'U', ActionSelect);
|
||||
REFIT_MENU_ITEM_RETURN MenuEntryReturn (L"Return", 0, 0, 0, ActionEnter);
|
||||
REFIT_MENU_ITEM_OPTIONS MenuEntryOptions (XStringWP("Options"), 1, 0, 'O', ActionEnter);
|
||||
REFIT_MENU_ITEM_ABOUT MenuEntryAbout (XStringWP("About Clover"), 1, 0, 'A', ActionEnter);
|
||||
REFIT_MENU_ITEM_RESET MenuEntryReset (XStringWP("Restart Computer"), 1, 0, 'R', ActionSelect);
|
||||
REFIT_MENU_ITEM_SHUTDOWN MenuEntryShutdown(XStringWP("Exit Clover"), 1, 0, 'U', ActionSelect);
|
||||
REFIT_MENU_ITEM_RETURN MenuEntryReturn (XStringWP("Return"), 0, 0, 0, ActionEnter);
|
||||
|
||||
|
||||
|
||||
@ -1344,7 +1344,7 @@ VOID REFIT_MENU_SCREEN::AddMenuInfo(CONST CHAR16 *Line)
|
||||
|
||||
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
|
||||
InputBootArgs = new REFIT_INFO_DIALOG;
|
||||
InputBootArgs->Title.SPrintf("%ls", Line);
|
||||
InputBootArgs->Title.takeValueFrom(Line);
|
||||
// InputBootArgs->Tag = TAG_INFO;
|
||||
// InputBootArgs->Item = NULL;
|
||||
InputBootArgs->AtClick = ActionLight;
|
||||
@ -2175,7 +2175,9 @@ VOID REFIT_MENU_SCREEN::KillMouse()
|
||||
|
||||
VOID REFIT_MENU_SCREEN::AddMenuInfoLine(IN CONST CHAR16 *InfoLine)
|
||||
{
|
||||
InfoLines.Add(InfoLine);
|
||||
XStringW* s = new XStringW();
|
||||
s->takeValueFrom(InfoLine);
|
||||
InfoLines.AddReference(s, true);
|
||||
// AddListElement((VOID ***) &(Screen->InfoLines), (UINTN*)&(Screen->InfoLines.size()), (CHAR16*)InfoLine); // TODO jief : cast to fix
|
||||
}
|
||||
|
||||
@ -2205,28 +2207,31 @@ VOID REFIT_MENU_SCREEN::FreeMenu()
|
||||
Tentry->SubScreen->FreeMenu();
|
||||
Tentry->SubScreen = NULL;
|
||||
}
|
||||
if (Tentry->getREFIT_MENU_ITEM_RETURN()) { //can't free constants
|
||||
if (Tentry->Title) {
|
||||
FreePool(Tentry->Title);
|
||||
Tentry->Title = NULL;
|
||||
}
|
||||
}
|
||||
FreePool(Tentry);
|
||||
// Title is a XStringW. It'll be destroyed in REFIT_MENU_SCREEN dtor
|
||||
// if (Tentry->getREFIT_MENU_ITEM_RETURN()) { //can't free constants
|
||||
// if (Tentry->Title) {
|
||||
// FreePool(Tentry->Title);
|
||||
// Tentry->Title = NULL;
|
||||
// }
|
||||
// }
|
||||
// Tentry is an object inserted in a XArray. It'll deleted at Entries.Empty()
|
||||
// FreePool(Tentry);
|
||||
}
|
||||
Entries.Empty();
|
||||
// FreePool(Screen->Entries);
|
||||
// Screen->Entries = NULL;
|
||||
}
|
||||
if (InfoLines.size() > 0) {
|
||||
for (UINTN i = 0; i < InfoLines.size(); i++) {
|
||||
// TODO: call a user-provided routine for each element here
|
||||
FreePool(InfoLines[i]);
|
||||
}
|
||||
InfoLines.Empty();
|
||||
// Infolines will deleted at InfoLines.Empty()
|
||||
// if (InfoLines.size() > 0) {
|
||||
// for (UINTN i = 0; i < InfoLines.size(); i++) {
|
||||
// // TODO: call a user-provided routine for each element here
|
||||
// FreePool(InfoLines[i]);
|
||||
// }
|
||||
// Screen->InfoLines.size() = 0;
|
||||
// FreePool(Screen->InfoLines);
|
||||
// Screen->InfoLines = NULL;
|
||||
}
|
||||
// }
|
||||
InfoLines.Empty();
|
||||
|
||||
}
|
||||
|
||||
@ -4353,7 +4358,7 @@ UINTN REFIT_MENU_SCREEN::RunMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
|
||||
|
||||
REFIT_ABSTRACT_MENU_ENTRY* NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
|
||||
{
|
||||
Entry->Title.SPrintf("%s", Title);
|
||||
Entry->Title.takeValueFrom(Title);
|
||||
// if (Title) {
|
||||
// } else {
|
||||
// Entry->Title = (__typeof__(Entry->Title))AllocateZeroPool(128);
|
||||
@ -4395,7 +4400,7 @@ VOID REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum)
|
||||
|
||||
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
|
||||
InputBootArgs = new REFIT_MENU_CHECKBIT;
|
||||
InputBootArgs->Title.SPrintf("%s", Text);
|
||||
InputBootArgs->Title.takeValueFrom(Text);
|
||||
// InputBootArgs->Tag = TAG_CHECKBIT_OLD;
|
||||
InputBootArgs->Row = Bit;
|
||||
InputBootArgs->Item = &InputItems[ItemNum];
|
||||
@ -4431,7 +4436,7 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
|
||||
|
||||
VOID REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
|
||||
{
|
||||
InputBootArgs->Title.SPrintf("%s", Line);
|
||||
InputBootArgs->Title.takeValueFrom(Line);
|
||||
if (Inx == 3 || Inx == 116) {
|
||||
InputBootArgs->Row = 0;
|
||||
} else {
|
||||
@ -5115,7 +5120,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches() //yyyy
|
||||
for (Index = 0; Index < PatchDsdtNum; Index++) {
|
||||
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
|
||||
InputBootArgs = new REFIT_INPUT_DIALOG;
|
||||
InputBootArgs->Title.SPrintf("%s", gSettings.PatchDsdtLabel[Index]);
|
||||
InputBootArgs->Title.takeValueFrom(gSettings.PatchDsdtLabel[Index]);
|
||||
// InputBootArgs->Tag = TAG_INPUT;
|
||||
InputBootArgs->Row = 0xFFFF; //cursor
|
||||
InputBootArgs->Item = &DSDTPatchesMenu[Index];
|
||||
@ -5143,7 +5148,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts()
|
||||
for (i = 0; i < DsdtsNum; i++) {
|
||||
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
|
||||
InputBootArgs = new REFIT_MENU_SWITCH;
|
||||
InputBootArgs->Title.SPrintf("%ls", DsdtsList[i]);
|
||||
InputBootArgs->Title.takeValueFrom(DsdtsList[i]);
|
||||
// InputBootArgs->Tag = TAG_SWITCH_OLD;
|
||||
InputBootArgs->Row = i + 1;
|
||||
InputBootArgs->Item = &InputItems[116];
|
||||
@ -5328,7 +5333,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuThemes()
|
||||
for (i = 0; i < ThemesNum; i++) {
|
||||
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
|
||||
InputBootArgs = new REFIT_MENU_SWITCH;
|
||||
InputBootArgs->Title.SPrintf("%ls", ThemesList[i]);
|
||||
InputBootArgs->Title.takeValueFrom(ThemesList[i]);
|
||||
// InputBootArgs->Tag = TAG_SWITCH_OLD;
|
||||
InputBootArgs->Row = i + 1;
|
||||
InputBootArgs->Item = &InputItems[3];
|
||||
@ -5464,7 +5469,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuConfigs()
|
||||
for (i = 0; i < ConfigsNum; i++) {
|
||||
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
|
||||
InputBootArgs = new REFIT_MENU_SWITCH;
|
||||
InputBootArgs->Title.SPrintf("%ls", ConfigsList[i]);
|
||||
InputBootArgs->Title.takeValueFrom(ConfigsList[i]);
|
||||
// InputBootArgs->Tag = TAG_SWITCH_OLD;
|
||||
InputBootArgs->Row = i;
|
||||
InputBootArgs->Item = &InputItems[90];
|
||||
|
Loading…
Reference in New Issue
Block a user