diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index f628abad1b..058a389bd0 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -635,7 +635,7 @@ typedef char* VA_LIST; #define VA_END(Marker) (Marker = (VA_LIST) 0) #define VA_COPY(Dest, Start) ((void)((Dest) = (Start))) -#elif defined(__GNUC__) || defined(__clang__) //SI? +#elif defined(__GNUC__) || defined(__clang__) #if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS) // diff --git a/rEFIt_UEFI/Platform/APFS.cpp b/rEFIt_UEFI/Platform/APFS.cpp index b368023530..0deae3d1c7 100644 --- a/rEFIt_UEFI/Platform/APFS.cpp +++ b/rEFIt_UEFI/Platform/APFS.cpp @@ -49,7 +49,7 @@ EFI_GUID APFSPartitionUUIDExtract( } if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) { //Check that vendor-assigned EFI_GUID defines APFS Container Partition - if ( ApfsSignatureUUID == *(const EFI_GUID *)((UINT8 *)DevicePath+0x04) ) { + if ( ApfsSignatureUUID == *(EFI_GUID *)((UINT8 *)DevicePath+0x04) ) { return *(EFI_GUID *)((UINT8 *)DevicePath+0x14); } } diff --git a/rEFIt_UEFI/PlatformEFI/cpp_util/operatorNewDelete.cpp b/rEFIt_UEFI/PlatformEFI/cpp_util/operatorNewDelete.cpp index f11bafb0d5..1aee545b8a 100644 --- a/rEFIt_UEFI/PlatformEFI/cpp_util/operatorNewDelete.cpp +++ b/rEFIt_UEFI/PlatformEFI/cpp_util/operatorNewDelete.cpp @@ -51,11 +51,6 @@ void operator delete ( void* ptr ) noexcept FreePool(ptr); } -void operator delete[](void* ptr) noexcept -{ - FreePool(ptr); -} - #ifdef _MSC_VER void _cdecl operator delete (void * ptr, unsigned __int64 count) #else diff --git a/rEFIt_UEFI/PlatformPOSIX+EFI/cpp_util/operatorNewDelete.cpp b/rEFIt_UEFI/PlatformPOSIX+EFI/cpp_util/operatorNewDelete.cpp index 3ba02e2ec5..daf9a10290 100644 --- a/rEFIt_UEFI/PlatformPOSIX+EFI/cpp_util/operatorNewDelete.cpp +++ b/rEFIt_UEFI/PlatformPOSIX+EFI/cpp_util/operatorNewDelete.cpp @@ -48,12 +48,7 @@ void operator delete ( void* ptr ) noexcept { // ++operator_delete_count1; // MemLogf(false, 0, "operator delete(%llx) %lld\n", uintptr_t(ptr), operator_delete_count1); - FreePool(ptr); -} - -void operator delete[](void* ptr) noexcept -{ - FreePool(ptr); + return FreePool(ptr); } #ifdef _MSC_VER @@ -64,7 +59,7 @@ void operator delete (void * ptr, UINTN count) { // ++operator_delete_count2; // MemLogf(false, 0, "operator delete(%llx, %lld) %lld\n", uintptr_t(ptr), count, operator_delete_count2); - FreePool(ptr); + return FreePool(ptr); } diff --git a/rEFIt_UEFI/PlatformPOSIX/cpp_util/operatorNewDelete.cpp b/rEFIt_UEFI/PlatformPOSIX/cpp_util/operatorNewDelete.cpp index 3ba02e2ec5..daf9a10290 100644 --- a/rEFIt_UEFI/PlatformPOSIX/cpp_util/operatorNewDelete.cpp +++ b/rEFIt_UEFI/PlatformPOSIX/cpp_util/operatorNewDelete.cpp @@ -48,12 +48,7 @@ void operator delete ( void* ptr ) noexcept { // ++operator_delete_count1; // MemLogf(false, 0, "operator delete(%llx) %lld\n", uintptr_t(ptr), operator_delete_count1); - FreePool(ptr); -} - -void operator delete[](void* ptr) noexcept -{ - FreePool(ptr); + return FreePool(ptr); } #ifdef _MSC_VER @@ -64,7 +59,7 @@ void operator delete (void * ptr, UINTN count) { // ++operator_delete_count2; // MemLogf(false, 0, "operator delete(%llx, %lld) %lld\n", uintptr_t(ptr), count, operator_delete_count2); - FreePool(ptr); + return FreePool(ptr); } diff --git a/rEFIt_UEFI/cpp_foundation/XStringAbstract.h b/rEFIt_UEFI/cpp_foundation/XStringAbstract.h index d9903724b0..b0e182dcb0 100644 --- a/rEFIt_UEFI/cpp_foundation/XStringAbstract.h +++ b/rEFIt_UEFI/cpp_foundation/XStringAbstract.h @@ -501,9 +501,8 @@ class __String { } ThisXStringClass subString(size_t pos, size_t count) const { - size_t len = length(); - if (pos >= len || count == 0) return ThisXStringClass(); - if (count > len - pos) count = len - pos; + // if ( pos > length() ) return ThisXStringClass(); + // if ( count > length()-pos ) count = length()-pos; ThisXStringClass ret; @@ -1015,11 +1014,11 @@ class XStringAbstract : public __String { *this = S; } - ~XStringAbstract() { - // DBG_XSTRING("Destructor :%ls\n", data()); - if (m_allocatedSize > 0) - delete[] super::__m_data; - } + ~XStringAbstract() { + // DBG_XSTRING("Destructor :%ls\n", data()); + if (m_allocatedSize > 0) + delete super::__m_data; + } #ifdef XSTRING_CACHING_OF_SIZE /* ctor */ @@ -1086,13 +1085,10 @@ class XStringAbstract : public __String { #endif /* Copy Assign */ XStringAbstract &operator=(const XStringAbstract &S) { - if (this == &S) { - return *this; - } if (S.data() && S.m_allocatedSize == 0) { // S points to a litteral if (m_allocatedSize > 0) { - delete[] super::__m_data; + delete super::__m_data; m_allocatedSize = 0; } super::__m_data = @@ -1110,7 +1106,7 @@ class XStringAbstract : public __String { /* Copy Assign */ XStringAbstract &operator=(const ls_t &S) { if (m_allocatedSize > 0) { - delete[] super::__m_data; + delete super::__m_data; m_allocatedSize = 0; } super::__m_data = (T *)S.data(); // because it's a litteral, we don't copy. @@ -1635,7 +1631,7 @@ class XStringAbstract : public __String { /* size is in number of technical chars, NOT in bytes */ ThisXStringClass &stealValueFrom(T *S, size_t allocatedSize) { if (m_allocatedSize > 0) - delete[] super::__m_data; + delete super::__m_data; super::__m_data = S; #ifdef XSTRING_CACHING_OF_SIZE super::__m_size = utf_size_of_utf_string(super::__m_data, super::__m_data); @@ -1648,7 +1644,7 @@ class XStringAbstract : public __String { // a future realloc may fail as EDK want the old size. ThisXStringClass &stealValueFrom(T *S) { if (m_allocatedSize > 0) - delete[] super::__m_data; + delete super::__m_data; super::__m_data = S; #ifdef XSTRING_CACHING_OF_SIZE super::__m_size = utf_size_of_utf_string(super::__m_data, super::__m_data); @@ -1661,7 +1657,7 @@ class XStringAbstract : public __String { ThisXStringClass &stealValueFrom(ThisXStringClass *S) { if (m_allocatedSize > 0) - delete[] super::__m_data; + delete super::__m_data; #ifdef XSTRING_CACHING_OF_SIZE super::__m_size = S->size(); #endif diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 9ed8f79ee2..029d69261a 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -1686,14 +1686,8 @@ void LOADER_ENTRY::StartLoader() (UINT8 *)SysRoot; size_t i1 = forceKext.rindexOf("\\") + 1; - if (i1 == MAX_XSIZE) i1 = 0; size_t i2 = forceKext.rindexOf("."); - XStringW identifier; - if (i2 != MAX_XSIZE && i2 > i1) { - identifier = forceKext.subString(i1, i2 - i1); - } else { - identifier = forceKext.subString(i1, MAX_XSIZE); - } + XStringW identifier = forceKext.subString(i1, i2 - i1); OC_STRING_ASSIGN( mOpenCoreConfiguration.Kernel.Force.Values[kextIdx]->Identifier, S8Printf("%ls", identifier.wc_str()).c_str());