From 2313e8bac9acd942b137bd5e2d501e953b26d10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=98=D1=81=D0=B0?= =?UTF-8?q?=D0=BA=D0=BE=D0=B2?= Date: Fri, 12 Aug 2022 22:09:53 +0300 Subject: [PATCH] fix clang 13 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Сергей Исаков --- rEFIt_UEFI/Platform/smbios.cpp | 6 +++++- rEFIt_UEFI/cpp_foundation/XStringAbstract.h | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index 4ba8c1e97..baef145d7 100755 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -104,7 +104,11 @@ MEM_STRUCTURE gRAM; #define SMBIOS_PTR SIGNATURE_32('_','S','M','_') #define MAX_TABLE_SIZE 512 -#define smbios_offsetof(s,m) ( (SMBIOS_TABLE_STRING) ((UINT8*)&((s*)0)->m - (UINT8*)0)) +//#define smbios_offsetof(s,m) ( (SMBIOS_TABLE_STRING) ((UINT8*)&((s*)0)->m - (UINT8*)0)) +#ifndef smbios_offsetof +# define smbios_offsetof(TYPE, MEMBER) ((SMBIOS_TABLE_STRING)((size_t) &((TYPE *)0)->MEMBER)) +#endif + SMBIOS_TABLE_STRING SMBIOS_TABLE_TYPE0_STR_IDX[] = { smbios_offsetof(SMBIOS_TABLE_TYPE0, Vendor), diff --git a/rEFIt_UEFI/cpp_foundation/XStringAbstract.h b/rEFIt_UEFI/cpp_foundation/XStringAbstract.h index cdc0e69b7..ebdeac034 100644 --- a/rEFIt_UEFI/cpp_foundation/XStringAbstract.h +++ b/rEFIt_UEFI/cpp_foundation/XStringAbstract.h @@ -33,7 +33,7 @@ template int XStringAbstract__startWith(const S* src, const O* other, bool ignoreCase) { - size_t nb = 0; +// size_t nb = 0; const S* src2 = src; const O* other2 = other; @@ -50,7 +50,7 @@ int XStringAbstract__startWith(const S* src, const O* other, bool ignoreCase) if ( src_char32 != other_char32 ) return false; src2 = get_char32_from_string(src2, &src_char32); other2 = get_char32_from_string(other2, &other_char32); - nb += 1; +// nb += 1; }; return src_char32 != 0; } @@ -89,7 +89,7 @@ int XStringAbstract__compare(const S* src, const O* other, bool ignoreCase) if ( other == NULL || *other == 0 ) return 1; // size_t len_s = length_of_utf_string(src); // size_t len_other = length_of_utf_string(other); - size_t nb = 0; +// size_t nb = 0; const S* src2 = src; const O* other2 = other; @@ -105,7 +105,7 @@ int XStringAbstract__compare(const S* src, const O* other, bool ignoreCase) if ( src_char32 != other_char32 ) break; src2 = get_char32_from_string(src2, &src_char32); other2 = get_char32_from_string(other2, &other_char32); - nb += 1; +// nb += 1; }; if ( src_char32 == other_char32 ) return 0; return src_char32 > other_char32 ? 1 : -1;