diff --git a/Xcode/CloverConfigPlistValidator/CloverConfigPlistValidator.xcodeproj/project.pbxproj b/Xcode/CloverConfigPlistValidator/CloverConfigPlistValidator.xcodeproj/project.pbxproj index acbfc256b..4e0716eb5 100644 --- a/Xcode/CloverConfigPlistValidator/CloverConfigPlistValidator.xcodeproj/project.pbxproj +++ b/Xcode/CloverConfigPlistValidator/CloverConfigPlistValidator.xcodeproj/project.pbxproj @@ -24,6 +24,7 @@ 9A3BA374261E7A3F009E8B0F /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA9E50025CD2FF400BD5E8B /* Utils.cpp */; }; 9A3BA375261E7A5E009E8B0F /* guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA923C325CD5B1F00BD5E8B /* guid.cpp */; }; 9A3BA376261E7AF7009E8B0F /* b64cdecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A36E51E24F3B82A007A1107 /* b64cdecode.cpp */; }; + 9A3E3A50271F35C40077F37E /* VersionString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3E3A4F271F35C40077F37E /* VersionString.cpp */; }; 9A4185C02439F73A00BEAFB8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; }; 9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA7C2451C8330050B38B /* XString.cpp */; }; 9A7D518424FC32F700FA1CC3 /* XBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A7D518124FC32F700FA1CC3 /* XBuffer.cpp */; }; @@ -100,6 +101,8 @@ 9A36E4E324F3B537007A1107 /* xml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = ""; }; 9A36E51D24F3B82A007A1107 /* b64cdecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b64cdecode.h; sourceTree = ""; }; 9A36E51E24F3B82A007A1107 /* b64cdecode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b64cdecode.cpp; sourceTree = ""; }; + 9A3E3A4E271F35C40077F37E /* VersionString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VersionString.h; sourceTree = ""; }; + 9A3E3A4F271F35C40077F37E /* VersionString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VersionString.cpp; sourceTree = ""; }; 9A4147662604F82900440186 /* undefinable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = undefinable.h; sourceTree = ""; }; 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringArray.cpp; sourceTree = ""; }; 9A4185BF2439F73A00BEAFB8 /* XStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray.h; sourceTree = ""; }; @@ -321,6 +324,8 @@ 9A28CCAC241B816400F3D247 /* Platform */ = { isa = PBXGroup; children = ( + 9A3E3A4F271F35C40077F37E /* VersionString.cpp */, + 9A3E3A4E271F35C40077F37E /* VersionString.h */, 9A27557D263A02600095D456 /* CloverVersion.cpp */, 9A27557E263A02600095D456 /* CloverVersion.h */, 9A36E51E24F3B82A007A1107 /* b64cdecode.cpp */, @@ -757,6 +762,7 @@ 9A071C49261A44080007CC44 /* XmlLiteDictTypes.cpp in Sources */, 9A8792F7261886F6000B9362 /* abort.cpp in Sources */, 9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */, + 9A3E3A50271F35C40077F37E /* VersionString.cpp in Sources */, 9A3BA375261E7A5E009E8B0F /* guid.cpp in Sources */, 9A3BA372261E7931009E8B0F /* platformdata.cpp in Sources */, 9A2755752639E0500095D456 /* Config_Quirks.cpp in Sources */, diff --git a/Xcode/CloverConfigPlistValidator/src/main.cpp b/Xcode/CloverConfigPlistValidator/src/main.cpp index 67839d71a..9a4b084e7 100755 --- a/Xcode/CloverConfigPlistValidator/src/main.cpp +++ b/Xcode/CloverConfigPlistValidator/src/main.cpp @@ -58,6 +58,7 @@ extern "C" int main(int argc, const char * argv[]) path = "config-nowarning-noerror.plist"; path = "config-test2.plist"; path = "/Volumes/CL_EFI_VMDK/EFI/CLOVER/config.plist"; + //path = "/Volumes/CL_EFI_VMDK/EFI/CLOVER/smbios.plist"; #endif if ( !path ) { @@ -98,15 +99,17 @@ extern "C" int main(int argc, const char * argv[]) xmlLiteParser.init(buf, st.st_size); b = configPlistTest.parse(&xmlLiteParser, LString8("")); - for ( size_t idx = 0 ; idx < xmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) { - const XmlParserMessage& xmlMsg = xmlLiteParser.getErrorsAndWarnings()[idx]; - printf("%s: %s\n", xmlMsg.isError ? "Error" : "Warning", xmlMsg.msg.c_str()); + for ( size_t idx = 0 ; idx < xmlLiteParser.getXmlParserMessageArray().size() ; idx++ ) { + const XmlParserMessage& xmlMsg = xmlLiteParser.getXmlParserMessageArray()[idx]; + if ( xmlMsg.type != XmlParserMessageType::info ) { + printf("%s\n", xmlMsg.getFormattedMsg().c_str()); + } } if ( b ) { // if ( xmlLiteParser.getErrorsAndWarnings().size() > 0 ) { // printf("parse return true, but there is error and warnings! BUG !!"); // } - if ( xmlLiteParser.getErrorsAndWarnings().size() == 0 ) { + if ( xmlLiteParser.getXmlParserMessageArray().size() == 0 ) { printf("Your plist looks so wonderful. Well done!\n"); } return 0; diff --git a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj index 472d85cb5..8d4e30b04 100644 --- a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj +++ b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj @@ -115,6 +115,8 @@ 9A2755482639DF1B0095D456 /* xml_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A8787B826186896000B9362 /* xml_lite-test.cpp */; }; 9A2755492639DF1B0095D456 /* xml_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A8787B826186896000B9362 /* xml_lite-test.cpp */; }; 9A27554A2639DF1C0095D456 /* xml_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A8787B826186896000B9362 /* xml_lite-test.cpp */; }; + 9A3E3A4C271E2FAE0077F37E /* xml_lite-reapeatingdict-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3E3A4A271E2FAD0077F37E /* xml_lite-reapeatingdict-test.cpp */; }; + 9A3E3A4D271E2FAE0077F37E /* xml_lite-reapeatingdict-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A3E3A4B271E2FAE0077F37E /* xml_lite-reapeatingdict-test.h */; }; 9A63C6CB24EBEF78000EB836 /* Version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A63C6CA24EBEF78000EB836 /* Version.h */; }; 9A7D2E922636B4F300187064 /* CloverVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A7D2E902636B4F200187064 /* CloverVersion.h */; }; 9A7D2E932636B4F300187064 /* CloverVersion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A7D2E912636B4F300187064 /* CloverVersion.cpp */; }; @@ -1098,6 +1100,8 @@ 9A2754E626396F2A0095D456 /* SmbiosFillPatchingValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmbiosFillPatchingValues.cpp; sourceTree = ""; }; 9A2754E726396F2B0095D456 /* SmbiosFillPatchingValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmbiosFillPatchingValues.h; sourceTree = ""; }; 9A2754EE263985A90095D456 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 9A3E3A4A271E2FAD0077F37E /* xml_lite-reapeatingdict-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "xml_lite-reapeatingdict-test.cpp"; sourceTree = ""; }; + 9A3E3A4B271E2FAE0077F37E /* xml_lite-reapeatingdict-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "xml_lite-reapeatingdict-test.h"; sourceTree = ""; }; 9A63C6CA24EBEF78000EB836 /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Version.h; path = ../../Version.h; sourceTree = ""; }; 9A7D2E902636B4F200187064 /* CloverVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloverVersion.h; sourceTree = ""; }; 9A7D2E912636B4F300187064 /* CloverVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CloverVersion.cpp; sourceTree = ""; }; @@ -1617,6 +1621,8 @@ 9A8787B326186896000B9362 /* XArray_tests.h */, 9A8787AE26186896000B9362 /* XBuffer_tests.cpp */, 9A8787AC26186896000B9362 /* XBuffer_tests.h */, + 9A3E3A4A271E2FAD0077F37E /* xml_lite-reapeatingdict-test.cpp */, + 9A3E3A4B271E2FAE0077F37E /* xml_lite-reapeatingdict-test.h */, 9A8787B826186896000B9362 /* xml_lite-test.cpp */, 9A8787B026186896000B9362 /* xml_lite-test.h */, 9A8787C526186896000B9362 /* XObjArray_tests.cpp */, @@ -2057,6 +2063,7 @@ 9A878C2726186898000B9362 /* loader.h in Headers */, 9A878C9326186898000B9362 /* XStringAbstract.h in Headers */, 9A878A6B26186897000B9362 /* BasicIO.h in Headers */, + 9A3E3A4D271E2FAE0077F37E /* xml_lite-reapeatingdict-test.h in Headers */, 9A8789F326186897000B9362 /* gma.h in Headers */, 9A87895A26186897000B9362 /* xml_lite-test.h in Headers */, 9A878B8B26186898000B9362 /* XTheme.h in Headers */, @@ -2794,6 +2801,7 @@ 9A878C6326186898000B9362 /* screen.cpp in Sources */, 9A87899C26186897000B9362 /* XArray_tests.cpp in Sources */, 9A878A1426186897000B9362 /* TagDate.cpp in Sources */, + 9A3E3A4C271E2FAE0077F37E /* xml_lite-reapeatingdict-test.cpp in Sources */, 9A87891E26186897000B9362 /* BootLog.cpp in Sources */, 9AF4D943263004E200487D15 /* XmlLiteSimpleTypes.cpp in Sources */, 9A878B8826186898000B9362 /* text.cpp in Sources */, diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 8d299e85d..cef6fd1a3 100755 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -2864,13 +2864,9 @@ public: // KernelAndKextPatches XBool KextPatchesAllowed = true; XBool KernelPatchesAllowed = true; //From GUI: Only for user patches, not internal Clover - - XString8 BiosVersionUsed = XString8(); - XString8 EfiVersionUsed = XString8(); - XString8 ReleaseDateUsed = XString8(); UINT8 flagstate[32] = {0}; - MacModel CurrentModel = MaxMachineType; + MacModel CurrentModel = MaxMacModel; UINT32 IgPlatform = UINT32(); //could also be snb-platform-id diff --git a/rEFIt_UEFI/Platform/VersionString.cpp b/rEFIt_UEFI/Platform/VersionString.cpp index daa65c793..d3b8fb430 100755 --- a/rEFIt_UEFI/Platform/VersionString.cpp +++ b/rEFIt_UEFI/Platform/VersionString.cpp @@ -48,7 +48,7 @@ UINT64 AsciiStrVersionToUint64(const XString8& Version_, UINT8 MaxDigitByPart, U part_value = max_part_value; } else if (Version[idx] == '.') { - result = MultU64x64(result, part_mult) + part_value; + result = (result * part_mult) + part_value; part_value = 0; MaxParts--; } @@ -56,7 +56,7 @@ UINT64 AsciiStrVersionToUint64(const XString8& Version_, UINT8 MaxDigitByPart, U } while (MaxParts--) { - result = MultU64x64(result, part_mult) + part_value; + result = (result * part_mult) + part_value; part_value = 0; // part_value is only used at first pass } diff --git a/rEFIt_UEFI/Platform/cpu.cpp b/rEFIt_UEFI/Platform/cpu.cpp index fe79e3036..4ac4c3845 100755 --- a/rEFIt_UEFI/Platform/cpu.cpp +++ b/rEFIt_UEFI/Platform/cpu.cpp @@ -1434,6 +1434,7 @@ UINT16 GetAdvancedCpuType() return GetStandardCpuType(); } +// GetDefaultModel() MUST NOT return MaxMacModel MacModel GetDefaultModel() { MacModel DefaultType = iMac132; diff --git a/rEFIt_UEFI/Platform/platformdata.cpp b/rEFIt_UEFI/Platform/platformdata.cpp index 16048b50f..849f6dc0a 100644 --- a/rEFIt_UEFI/Platform/platformdata.cpp +++ b/rEFIt_UEFI/Platform/platformdata.cpp @@ -83,8 +83,8 @@ constexpr bool ApplePlatformDataArrayClass::asserts() const PLATFORMDATA& ApplePlatformDataArrayClass::operator [] (MacModel m) { - if ( m >= MaxMachineType ) { - log_technical_bug("ApplePlatformDataArrayClass : m >= MaxMachineType"); + if ( m >= MaxMacModel ) { + log_technical_bug("ApplePlatformDataArrayClass : m >= MaxMacModel"); return ApplePlatformDataArrayClass::m_ApplePlatformDataArrayClass[getDefaultModel()]; } for ( size_t idx = 0 ; idx < sizeof(m_ApplePlatformDataArrayClass)/sizeof(m_ApplePlatformDataArrayClass[0]) ; idx++ ) { @@ -436,7 +436,7 @@ XBool GetMobile(MacModel Model) case Xserve21: case Xserve31: return false; - case MaxMachineType: // currently a copy of iMac132 + case MaxMacModel: // currently a copy of iMac132 return false; default: // bug, unknown Apple model log_technical_bug("%s : cannot find model %d\n", __PRETTY_FUNCTION__, Model); @@ -773,11 +773,11 @@ XString8 GetReleaseDate(MacModel Model) return returnValue; } -void SetDMISettingsForModel(MacModel Model, SETTINGS_DATA* settingsData, REFIT_CONFIG* liveConfig) +void SetDMISettingsForModel(MacModel Model, SETTINGS_DATA* settingsData) { - liveConfig->BiosVersionUsed = ApplePlatformDataArray[Model].firmwareVersion; - liveConfig->ReleaseDateUsed = GetReleaseDate(Model); // AppleReleaseDate - liveConfig->EfiVersionUsed.takeValueFrom(ApplePlatformDataArray[Model].efiversion); + settingsData->Smbios.BiosVersion = ApplePlatformDataArray[Model].firmwareVersion; + settingsData->Smbios.BiosReleaseDate = GetReleaseDate(Model); + settingsData->Smbios.EfiVersion = ApplePlatformDataArray[Model].efiversion; settingsData->Smbios.BiosVendor = AppleBiosVendor; settingsData->Smbios.ManufactureName = settingsData->Smbios.BiosVendor; @@ -810,13 +810,13 @@ MacModel GetModelFromString(const XString8& ProductName) { MacModel i; - for (i = (MacModel)(0); i < MaxMachineType; i = (MacModel)(i + 1)) { + for (i = (MacModel)(0); i < MaxMacModel; i = (MacModel)(i + 1)) { if ( ProductName == MachineModelName[i] ) { return i; } } // return ending enum as "not found" - return MaxMachineType; + return MaxMacModel; } uint8_t GetChassisTypeFromModel(MacModel Model) diff --git a/rEFIt_UEFI/Platform/platformdata.h b/rEFIt_UEFI/Platform/platformdata.h index 624b7fd71..035b4ac49 100644 --- a/rEFIt_UEFI/Platform/platformdata.h +++ b/rEFIt_UEFI/Platform/platformdata.h @@ -24,7 +24,7 @@ typedef enum { #include "PlatformdataModels.h" #undef DEFINE_ENUM - MaxMachineType + MaxMacModel } MacModel; @@ -591,10 +591,6 @@ class ApplePlatformDataArrayClass { Xserve31, "XS31.88Z.0081.B06.0908061300"_XS8, ""_XS8, "Mac-F223BEC8"_XS8, // Intel Xeon E5520 @ 2.26 GHz "Xserve"_XS8, "1.0"_XS8, "CK933YJ16HS"_XS8, "Xserve"_XS8, 0x01, 0x43, 0x0f, 0, 0, 0x04, "NA"_XS8, "NA"_XS8, 0x79001 }, // need rBR RPlt EPCI - // //MaxMachineType : default to iMac132 - // { iMac132, "IM131.88Z.F000.B00.2004121616"_XS8, "291.0.0.0.0"_XS8, "Mac-FC02E91DDD3FA6A4"_XS8, // Intel Core i5-3470 @ 3.20 GHz - // "iMac"_XS8, "1.0"_XS8, "C02JB041DNCW"_XS8, "iMac-Aluminum"_XS8, - // 0x02, 0x11, 0x0f, 0, 0, 0x16, "d8"_XS8, "d8"_XS8, 0x79006 }, }; static constexpr const size_t ApplePlatformData_priv_size = sizeof(m_ApplePlatformDataArrayClass)/sizeof(m_ApplePlatformDataArrayClass[0]); static constexpr bool hasPlatformData(size_t idx, MacModel m) @@ -613,7 +609,7 @@ public: extern ApplePlatformDataArrayClass ApplePlatformDataArray; -void SetDMISettingsForModel(MacModel Model, SETTINGS_DATA* settingsData, REFIT_CONFIG* liveConfig); +void SetDMISettingsForModel(MacModel Model, SETTINGS_DATA* settingsData); MacModel GetModelFromString (const XString8& ProductName); XBool isReleaseDateWithYear20(MacModel Model); diff --git a/rEFIt_UEFI/Settings/ConfigManager.cpp b/rEFIt_UEFI/Settings/ConfigManager.cpp index bc3d3ab1b..f41933211 100644 --- a/rEFIt_UEFI/Settings/ConfigManager.cpp +++ b/rEFIt_UEFI/Settings/ConfigManager.cpp @@ -525,15 +525,15 @@ EFI_STATUS LoadPlist(const XStringW& ConfName, C* plist) XmlLiteParser xmlLiteParser; XBool parsingOk = plist->parse((const CHAR8*)ConfigPtr, Size, ""_XS8, &xmlLiteParser); - if ( xmlLiteParser.getErrorsAndWarnings().size() ) { - if ( xmlLiteParser.getErrorsAndWarnings().size() > 1 ) { + if ( xmlLiteParser.getXmlParserMessageArray().size() ) { + if ( xmlLiteParser.getXmlParserMessageArray().size() > 1 ) { DebugLog(2, "There are problems in plist '%ls'\n", configPlistPath.wc_str()); }else{ DebugLog(2, "There is a problem in plist '%ls'\n", configPlistPath.wc_str()); } - for ( size_t idx = 0 ; idx < xmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) { - const XmlParserMessage& xmlMsg = xmlLiteParser.getErrorsAndWarnings()[idx]; - DebugLog(2, "%s: %s\n", xmlMsg.isError ? "Error" : "Warning", xmlMsg.msg.c_str()); + for ( size_t idx = 0 ; idx < xmlLiteParser.getXmlParserMessageArray().size() ; idx++ ) { + const XmlParserMessage& xmlMsg = xmlLiteParser.getXmlParserMessageArray()[idx]; + DebugLog(2, "%s\n", xmlMsg.getFormattedMsg().c_str()); } DebugLog(2, "Use CloverConfigPlistValidator or look in the log\n"); } @@ -542,7 +542,7 @@ EFI_STATUS LoadPlist(const XStringW& ConfName, C* plist) Status = EFI_LOAD_ERROR; } - if ( !parsingOk || xmlLiteParser.getErrorsAndWarnings().size() > 0 ) gBS->Stall(3000000); // 3 seconds delay + if ( !parsingOk || xmlLiteParser.getXmlParserMessageArray().size() > 0 ) gBS->Stall(3000000); // 3 seconds delay return Status; } @@ -553,6 +553,7 @@ return Status; */ EFI_STATUS ConfigManager::LoadConfigPlist(const XStringW& ConfName) { + configPlist.SMBIOS.defaultMacModel = GetDefaultModel(); EFI_STATUS Status = LoadPlist(ConfName, &configPlist); return Status; @@ -564,6 +565,7 @@ EFI_STATUS ConfigManager::LoadConfigPlist(const XStringW& ConfName) */ EFI_STATUS ConfigManager::LoadSMBIOSPlist(const XStringW& ConfName) { + smbiosPlist.SMBIOS.defaultMacModel = GetDefaultModel(); EFI_STATUS Status = LoadPlist(ConfName, &smbiosPlist); if ( EFI_ERROR(Status) ) { @@ -575,80 +577,85 @@ EFI_STATUS ConfigManager::LoadSMBIOSPlist(const XStringW& ConfName) void ConfigManager::FillSmbiosWithDefaultValue(MacModel Model, const SmbiosPlistClass::SmbiosDictClass& smbiosDictClass) { - GlobalConfig.CurrentModel = Model; +// Checks are now done in SmbiosDictClass - //GlobalConfig.BiosVersionUsed = ApplePlatformData[Model].firmwareVersion; - // Check for BiosVersion and BiosReleaseDate by Sherlocks - if ( smbiosDictClass.getBiosVersion().isDefined() ) { - int c = compareBiosVersion(GlobalConfig.BiosVersionUsed, smbiosDictClass.dgetBiosVersion()); - if ( c == 0 ) { - DBG("Found same BiosVersion in clover and config\n"); - }else - if ( c < 0 ) { - DBG("Using latest BiosVersion from config\n"); - GlobalConfig.BiosVersionUsed = smbiosDictClass.dgetBiosVersion(); - }else{ - DBG("Using latest BiosVersion from clover\n"); - } - }else{ - DBG("BiosVersion: not set, Using BiosVersion from clover\n"); - } - DBG("BiosVersion: %s\n", GlobalConfig.BiosVersionUsed.c_str()); +// //gSettings.Smbios.BiosVersion = ApplePlatformData[Model].firmwareVersion; +// // Check for BiosVersion and BiosReleaseDate by Sherlocks +// if ( smbiosDictClass.getBiosVersion().isDefined() ) { +// int c = compareBiosVersion(gSettings.Smbios.BiosVersion, smbiosDictClass.dgetBiosVersion()); +// if ( c == 0 ) { +// DBG("Found same BiosVersion in clover and config\n"); +// }else +// if ( c < 0 ) { +// DBG("Using latest BiosVersion from config\n"); +// gSettings.Smbios.BiosVersion = smbiosDictClass.dgetBiosVersion(); +// }else{ +// DBG("Using latest BiosVersion from clover\n"); +// } +// }else{ +// DBG("BiosVersion: not set, Using BiosVersion from clover\n"); +// } +// DBG("BiosVersion: %s\n", gSettings.Smbios.BiosVersion.c_str()); + if ( smbiosDictClass.getBiosVersion().isDefined() ) gSettings.Smbios.BiosVersion = smbiosDictClass.getBiosVersion().value(); - //GlobalConfig.ReleaseDateUsed = GetReleaseDate(Model); // AppleReleaseDate - int compareReleaseDateResult = 0; - if ( smbiosDictClass.getBiosReleaseDate().isDefined() ) { - compareReleaseDateResult = compareReleaseDate(GetReleaseDate(Model), smbiosDictClass.dgetBiosReleaseDate()); - if ( compareReleaseDateResult == 0 ) { - DBG("Found same BiosReleaseDate in clover and config\n"); - }else - if ( compareReleaseDateResult == -1 ) { - DBG("Using latest BiosReleaseDate from config\n"); - GlobalConfig.ReleaseDateUsed = smbiosDictClass.dgetBiosReleaseDate(); - }else - if ( compareReleaseDateResult == 1 ) { - DBG("Using latest BiosReleaseDate from clover\n"); - } - }else{ - DBG("BiosReleaseDate: not set, Using BiosReleaseDate from clover\n"); - } - if ( !smbiosDictClass.getBiosReleaseDate().isDefined() || compareReleaseDateResult == -2 ) - { - //DBG("Found unknown date format from config\n"); - size_t len = GlobalConfig.ReleaseDateUsed.length(); - const char* j = GlobalConfig.BiosVersionUsed.c_str(); +// //gSettings.Smbios.BiosReleaseDate = GetReleaseDate(Model); // AppleReleaseDate +// int compareReleaseDateResult = 0; +// if ( smbiosDictClass.getBiosReleaseDate().isDefined() ) { +// compareReleaseDateResult = compareReleaseDate(GetReleaseDate(Model), smbiosDictClass.dgetBiosReleaseDate()); +// if ( compareReleaseDateResult == 0 ) { +// DBG("Found same BiosReleaseDate in clover and config\n"); +// }else +// if ( compareReleaseDateResult == -1 ) { +// DBG("Using latest BiosReleaseDate from config\n"); +// gSettings.Smbios.BiosReleaseDate = smbiosDictClass.dgetBiosReleaseDate(); +// }else +// if ( compareReleaseDateResult == 1 ) { +// DBG("Using latest BiosReleaseDate from clover\n"); +// } +// }else{ +// DBG("BiosReleaseDate: not set, Using BiosReleaseDate from clover\n"); +// } +// if ( !smbiosDictClass.getBiosReleaseDate().isDefined() || compareReleaseDateResult == -2 ) +// { +// //DBG("Found unknown date format from config\n"); +// size_t len = gSettings.Smbios.BiosReleaseDate.length(); +// const char* j = gSettings.Smbios.BiosVersion.c_str(); +// +// j += AsciiStrLen(j); +// while (*j != '.') { +// j--; +// } +// +// if ( len == 8 ) { +// gSettings.Smbios.BiosReleaseDate.S8Printf("%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); +// //DBG("Using the date of used BiosVersion\n"); +// } else if ( len == 10 ) { +// gSettings.Smbios.BiosReleaseDate.S8Printf("%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); +// //DBG("Using the date of used BiosVersion\n"); +// } +// } +// DBG("BiosReleaseDate: %s\n", gSettings.Smbios.BiosReleaseDate.c_str()); - j += AsciiStrLen(j); - while (*j != '.') { - j--; - } - - if ( len == 8 ) { - GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); - //DBG("Using the date of used BiosVersion\n"); - } else if ( len == 10 ) { - GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); - //DBG("Using the date of used BiosVersion\n"); - } - } - DBG("BiosReleaseDate: %s\n", GlobalConfig.ReleaseDateUsed.c_str()); + if ( smbiosDictClass.getBiosReleaseDate().isDefined() ) gSettings.Smbios.BiosReleaseDate = smbiosDictClass.getBiosReleaseDate().value(); -// GlobalConfig.EfiVersionUsed.takeValueFrom(ApplePlatformData[Model].efiversion); - if ( smbiosDictClass.getEfiVersion().isDefined() ) { - if (AsciiStrVersionToUint64(GlobalConfig.EfiVersionUsed, 4, 5) > AsciiStrVersionToUint64(smbiosDictClass.dgetEfiVersion(), 4, 5)) { - DBG("Using latest EfiVersion from clover: %s\n", GlobalConfig.EfiVersionUsed.c_str()); - } else if (AsciiStrVersionToUint64(GlobalConfig.EfiVersionUsed, 4, 5) < AsciiStrVersionToUint64(smbiosDictClass.dgetEfiVersion(), 4, 5)) { - GlobalConfig.EfiVersionUsed = smbiosDictClass.dgetEfiVersion(); - DBG("Using latest EfiVersion from config: %s\n", GlobalConfig.EfiVersionUsed.c_str()); - } else { - DBG("Using EfiVersion from clover: %s\n", GlobalConfig.EfiVersionUsed.c_str()); - } - } else if ( GlobalConfig.EfiVersionUsed.notEmpty() ) { - DBG("Using EfiVersion from clover: %s\n", GlobalConfig.EfiVersionUsed.c_str()); - } +//// gSettings.Smbios.EfiVersion.takeValueFrom(ApplePlatformData[Model].efiversion); +// if ( smbiosDictClass.getEfiVersion().isDefined() ) { +// if (AsciiStrVersionToUint64(gSettings.Smbios.EfiVersion, 4, 5) > AsciiStrVersionToUint64(smbiosDictClass.dgetEfiVersion(), 4, 5)) { +// DBG("Using latest EfiVersion from clover: %s\n", gSettings.Smbios.EfiVersion.c_str()); +// } else if (AsciiStrVersionToUint64(gSettings.Smbios.EfiVersion, 4, 5) < AsciiStrVersionToUint64(smbiosDictClass.dgetEfiVersion(), 4, 5)) { +// gSettings.Smbios.EfiVersion = smbiosDictClass.dgetEfiVersion(); +// DBG("Using latest EfiVersion from config: %s\n", gSettings.Smbios.EfiVersion.c_str()); +// } else { +// DBG("Using EfiVersion from clover: %s\n", gSettings.Smbios.EfiVersion.c_str()); +// } +// } else if ( gSettings.Smbios.EfiVersion.notEmpty() ) { +// DBG("Using EfiVersion from clover: %s\n", gSettings.Smbios.EfiVersion.c_str()); +// } + + if ( smbiosDictClass.getEfiVersion().isDefined() ) gSettings.Smbios.EfiVersion = smbiosDictClass.getEfiVersion().value(); if ( smbiosDictClass.getBiosVendor().isDefined() ) gSettings.Smbios.BiosVendor = smbiosDictClass.getBiosVendor().value(); @@ -674,6 +681,21 @@ void ConfigManager::FillSmbiosWithDefaultValue(MacModel Model, const SmbiosPlist if ( smbiosDictClass.getBoardType().isDefined() ) gSettings.Smbios.BoardType = smbiosDictClass.getBoardType().value(); if ( smbiosDictClass.getChassisType().isDefined() ) gSettings.Smbios.ChassisType = smbiosDictClass.getChassisType().value(); if ( smbiosDictClass.getMobile().isDefined() ) gSettings.Smbios.Mobile = smbiosDictClass.getMobile().value(); + + // Debug messages. Not sure we need them anymore... + if ( smbiosDictClass.getBiosVersion().isDefined() ) { + DBG("Using latest BiosVersion from config instead of default '%s'\n", ApplePlatformDataArray[Model].firmwareVersion.c_str()); + } + if ( smbiosDictClass.getBiosReleaseDate().isDefined() ) { + DBG("Using latest BiosReleaseDate from config instead of default '%s'\n", GetReleaseDate(Model).c_str()); + } + if ( smbiosDictClass.getEfiVersion().isDefined() ) { + DBG("Using latest EfiVersion from config instead of default '%s'\n", ApplePlatformDataArray[Model].efiversion.c_str()); + } + DBG("BiosVersion: %s\n", gSettings.Smbios.BiosVersion.c_str()); + DBG("BiosReleaseDate: %s\n", gSettings.Smbios.BiosReleaseDate.c_str()); + DBG("EfiVersion: %s\n", gSettings.Smbios.EfiVersion.c_str()); + } void ConfigManager::applySettings() const @@ -892,26 +914,28 @@ EFI_STATUS ConfigManager::LoadConfig(const XStringW& ConfName) /*Status = */ LoadSMBIOSPlist(L"smbios"_XSW); // we don't need Status. If not loaded correctly, smbiosPlist is !defined and will be ignored by AssignOldNewSettings() - MacModel Model = iMac132; + GlobalConfig.CurrentModel = iMac132; if ( smbiosPlist.SMBIOS.isDefined() && smbiosPlist.SMBIOS.hasModel()) { - Model = smbiosPlist.SMBIOS.getModel(); + GlobalConfig.CurrentModel = smbiosPlist.SMBIOS.getModel(); } else if ( configPlist.getSMBIOS().hasModel() ) { - Model = configPlist.getSMBIOS().getModel(); + GlobalConfig.CurrentModel = configPlist.getSMBIOS().getModel(); } else { - Model = GetDefaultModel(); + log_technical_bug("No MacModel. SmbiosDictClass::defaultMacModel must be initialized before reading config or smbios plist."); + GlobalConfig.CurrentModel = GetDefaultModel(); } -// configPlist.getSMBIOS().ProductName.takeValueFrom(ApplePlatformData[Model].productName); //no such function? + if ( !EFI_ERROR(Status) ) { gSettings.takeValueFrom(configPlist); // if load failed, keep default value. } - // TODO improve this (avoid to delete settings to re-import them !) - // restore default value for SMBIOS (delete values from configPlist) - SetDMISettingsForModel(Model, &gSettings, &GlobalConfig); - // import values from configPlist if they are defined - FillSmbiosWithDefaultValue(Model, configPlist.getSMBIOS()); + // Fill in default for model + SetDMISettingsForModel(GlobalConfig.CurrentModel, &gSettings); + + // NOTE : values from smbios.plist and config.plist will be merge if both exist. + // Import values from configPlist if they are defined + FillSmbiosWithDefaultValue(GlobalConfig.CurrentModel, configPlist.getSMBIOS()); if ( smbiosPlist.SMBIOS.isDefined() ) { - // import values from smbiosPlist if they are defined - FillSmbiosWithDefaultValue(Model, smbiosPlist.SMBIOS); + // Import values from smbiosPlist if they are defined + FillSmbiosWithDefaultValue(GlobalConfig.CurrentModel, smbiosPlist.SMBIOS); } applySettings(); diff --git a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h index 11d2b7037..35b6ad382 100755 --- a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h @@ -73,7 +73,6 @@ public: GUI_Class GUI = GUI_Class(); Graphics_Class Graphics; // Cannot do this : = Graphics_Class(*this); because of a MSVC bug. Compilation failed at ssignment of m_fields because all member become const. KernelAndKextPatches_Class KernelAndKextPatches = KernelAndKextPatches_Class(); -protected: SmbiosPlistClass::SmbiosDictClass SMBIOS = SmbiosPlistClass::SmbiosDictClass(); // use the same dict as for standalone smbios plist public: SystemParameters_Class SystemParameters = SystemParameters_Class(); diff --git a/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h b/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h index b54a8dbfe..7b47af4fc 100755 --- a/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h @@ -22,6 +22,7 @@ #include "../../Platform/guid.h" #include "../../Platform/platformdata.h" #include "../../Platform/smbios.h" +#include "../../Platform/VersionString.h" // for AsciiStrVersionToUint64 //#include "../cpu.h" #include "../../cpp_lib/undefinable.h" @@ -385,16 +386,50 @@ public: } MacModel Model; Model = GetModelFromString(xstring8); - if ( Model == MaxMachineType ) return xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid ProductName '%s' in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine())); + if ( Model == MaxMacModel ) return xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid ProductName '%s' in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine())); + return true; + } + }; + + class BiosVersionClass : public XmlString8Trimed + { + using super = XmlString8Trimed; + public: + BiosVersionClass() : super(true) {}; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { + if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; + if ( !value().contains(".") ) { + return xmlLiteParser->addWarning(generateErrors, S8Printf("BiosVersion '%s' doesn't contains a dot in dict '%s:%d'.", value().c_str(), xmlPath.c_str(), keyPos.getLine())); + } + size_t rindex = value().rindexOf("."); + if ( value().length() - rindex < 7 ) { + return xmlLiteParser->addWarning(generateErrors, S8Printf("Last part of BiosVersion '%s' must be at least 6 chars in dict '%s:%d'.", value().c_str(), xmlPath.c_str(), keyPos.getLine())); + } + // Should we check the format of these 6 last chars ? + return true; + } + }; + + class BiosReleaseDateClass : public XmlString8Trimed + { + using super = XmlString8Trimed; + public: + BiosReleaseDateClass() : super(true) {}; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { + if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; + if ( value().length() != 8 && value().length() != 10 ) { + return xmlLiteParser->addWarning(generateErrors, S8Printf("BiosReleaseDate '%s' must 8 or 10 chars in dict '%s:%d'.", value().c_str(), xmlPath.c_str(), keyPos.getLine())); + } + // Should we check the format of these 8 or 10 last chars ? return true; } }; protected: XmlString8Trimed BiosVendor = XmlString8Trimed(true); // true = allow empty - XmlString8Trimed BiosVersion = XmlString8Trimed(true); // RomVersion + BiosVersionClass BiosVersion = BiosVersionClass(); // RomVersion XmlString8AllowEmpty EfiVersion = XmlString8AllowEmpty(); - XmlString8Trimed BiosReleaseDate = XmlString8Trimed(true); + BiosReleaseDateClass BiosReleaseDate = BiosReleaseDateClass(); XmlString8Trimed Manufacturer = XmlString8Trimed(true); ProductNameClass ProductName = ProductNameClass(); @@ -427,6 +462,8 @@ public: XmlUInt64 ExtendedFirmwareFeatures = XmlUInt64(); // gFwFeatures XmlUInt64 ExtendedFirmwareFeaturesMask = XmlUInt64(); public: + MacModel defaultMacModel = MaxMacModel; + MemoryDictClass Memory = MemoryDictClass(); SlotDeviceArrayClass Slots = SlotDeviceArrayClass(); @@ -469,30 +506,44 @@ public: virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; -// if ( !ProductName.isDefined() ) { + if ( !ProductName.isDefined() ) { // return xmlLiteParser->addWarning(generateErrors, S8Printf("ProductName is not defined, the whole SMBIOS dict is ignored at line %d.", keyPos.getLine())); -// } - if ( BiosVersion.isDefined() ) { - if ( !BiosVersion.value().contains(".") ) { - xmlLiteParser->addWarning(generateErrors, S8Printf("BiosVersion '%s' doesn't contains a dot in dict '%s:%d'.", BiosVersion.value().c_str(), xmlPath.c_str(), keyPos.getLine())); - BiosVersion.reset(); - }else{ - size_t rindex = BiosVersion.value().rindexOf("."); - if ( BiosVersion.value().length() - rindex < 7 ) { - xmlLiteParser->addWarning(generateErrors, S8Printf("Last part of BiosVersion '%s' must be at least 6 chars in dict '%s:%d'.", BiosVersion.value().c_str(), xmlPath.c_str(), keyPos.getLine())); + if ( defaultMacModel < MaxMacModel ) { + ProductName.setStringValue(MachineModelName[defaultMacModel]); + } + } + if ( hasModel() ) { + if ( BiosVersion.isDefined() ) { + if ( !is2ndBiosVersionGreaterThan1st(ApplePlatformDataArray[getModel()].firmwareVersion, BiosVersion.value()) ) { + xmlLiteParser->addWarning(generateErrors, S8Printf("BiosVersion '%s' is before than default ('%s') -> ignored. Dict '%s:%d'.", BiosVersion.value().c_str(), ApplePlatformDataArray[getModel()].firmwareVersion.c_str(), xmlPath.c_str(), keyPos.getLine())); BiosVersion.reset(); - }else{ - // Should we check the format of these 6 last chars ? - if ( hasModel() ) { - if ( !is2ndBiosVersionGreaterThan1st(ApplePlatformDataArray[getModel()].firmwareVersion, BiosVersion.value()) ) { - xmlLiteParser->addWarning(generateErrors, S8Printf("BiosVersion '%s' is before than default ('%s') -> ignored. Dict '%s:%d'.", BiosVersion.value().c_str(), ApplePlatformDataArray[getModel()].firmwareVersion.c_str(), xmlPath.c_str(), keyPos.getLine())); - BiosVersion.reset(); - } - }else{ -// xmlLiteParser->addWarning(generateErrors, S8Printf("Cannot check validity of BiosVersion because ProductName is not set. Dict '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); - } } } + if ( BiosReleaseDate.isDefined() ) { + int compareReleaseDateResult = compareReleaseDate(GetReleaseDate(getModel()), BiosReleaseDate.value()); + if ( compareReleaseDateResult == 0 ) { + // This is just 'info'. It's useless but fine to define the same as default. + xmlLiteParser->addInfo(generateErrors, S8Printf("BiosReleaseDate '%s' is the same as default ('%s') -> ignored. Dict '%s:%d'.", BiosReleaseDate.value().c_str(), GetReleaseDate(getModel()).c_str(), xmlPath.c_str(), keyPos.getLine())); + BiosReleaseDate.reset(); + }else + if ( compareReleaseDateResult == 1 ) { + xmlLiteParser->addWarning(generateErrors, S8Printf("BiosReleaseDate '%s' is older than default ('%s') -> ignored. Dict '%s:%d'.", BiosReleaseDate.value().c_str(), GetReleaseDate(getModel()).c_str(), xmlPath.c_str(), keyPos.getLine())); + BiosReleaseDate.reset(); + } + } + if ( EfiVersion.isDefined() ) { + if ( AsciiStrVersionToUint64(ApplePlatformDataArray[dgetModel()].efiversion, 4, 5) > AsciiStrVersionToUint64(EfiVersion.value(), 4, 5)) { + xmlLiteParser->addWarning(generateErrors, S8Printf("EfiVersion '%s' is older than default ('%s') -> ignored. Dict '%s:%d'.", EfiVersion.value().c_str(), ApplePlatformDataArray[dgetModel()].efiversion.c_str(), xmlPath.c_str(), keyPos.getLine())); + EfiVersion.reset(); + } else if (AsciiStrVersionToUint64(ApplePlatformDataArray[dgetModel()].efiversion, 4, 5) == AsciiStrVersionToUint64(EfiVersion.value(), 4, 5)) { + xmlLiteParser->addInfo(generateErrors, S8Printf("EfiVersion '%s' is the same as default ('%s') -> ignored. Dict '%s:%d'.", EfiVersion.value().c_str(), ApplePlatformDataArray[dgetModel()].efiversion.c_str(), xmlPath.c_str(), keyPos.getLine())); + } + } + }else{ + // This is supposed to never happen within Clover, because Clover initialise defaultMacModel. + // ccpv doesn't initialise defaultMacModel yet. + // If ccpv, let's say nothing at the moment + //xmlLiteParser->addInfo(generateErrors, S8Printf("Cannot check validity of BiosVersion because ProductName is not set. Dict '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); } return true; // we don't want to invalidate the whole dict } @@ -538,16 +589,18 @@ public: MacModel getModel() const { if ( !ProductName.isDefined() ) { + // This must not happen in Clover because Clover set a defaultMacModel + // This must ot happen in ccpv because ccpv doesn't call dget... methods log_technical_bug("%s : !ProductName.isDefined()", __PRETTY_FUNCTION__); - return GetDefaultModel(); + return iMac132; // cannot return GetDefaultModel() because we don't want to link runtime configuration to the xml reading layer. } - return GetModelFromString(ProductName.value()); // ProductName has been validated, so Model CANNOT be MaxMachineType + return GetModelFromString(ProductName.value()); // ProductName has been validated, so Model CANNOT be MaxMacModel } XBool hasModel() const { return ProductName.isDefined(); } MacModel dgetModel() const { - if ( !hasModel() ) return MaxMachineType; + if ( !hasModel() ) return MaxMacModel; return getModel(); } diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteParser.h b/rEFIt_UEFI/cpp_lib/XmlLiteParser.h index 930445ec1..c99311879 100755 --- a/rEFIt_UEFI/cpp_lib/XmlLiteParser.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteParser.h @@ -23,12 +23,26 @@ XBool strnIsEqual(const char* key, size_t keyLength, const char* value); XBool strnnIsEqualIC(const char* key, size_t keyLength, const char* value, size_t valueLength); XBool strnIsEqualIC(const char* key, size_t keyLength, const char* value); +enum class XmlParserMessageType +{ + error, + warning, + info +}; + class XmlParserMessage { public: - XBool isError = true; + XmlParserMessageType type; XString8 msg; - XmlParserMessage(XBool _isError, const XString8& _msg) : isError(_isError), msg(_msg) {}; + XmlParserMessage(XmlParserMessageType _type, const XString8& _msg) : type(_type), msg(_msg) {}; + + XString8 getFormattedMsg() const { + if ( type == XmlParserMessageType::info ) return S8Printf("Info: %s", msg.c_str()); + if ( type == XmlParserMessageType::warning ) return S8Printf("Warning: %s", msg.c_str()); + if ( type == XmlParserMessageType::error ) return S8Printf("Error: %s", msg.c_str()); + return msg; + } }; class XmlLiteParser; @@ -64,9 +78,9 @@ class XmlLiteParser XmlParserPosition currentPos = XmlParserPosition(); XObjArray errorsAndWarnings = XObjArray(); - XBool AddErrorOrWarning(XmlParserMessage* msg) { + XBool AddXmlParserMessage(XmlParserMessage* msg) { if ( errorsAndWarnings.size() < 500 ) errorsAndWarnings.AddReference(msg, true); - if ( errorsAndWarnings.size() == 500 ) errorsAndWarnings.AddReference(new XmlParserMessage(true, "Too many error. Stopping"_XS8), true); + if ( errorsAndWarnings.size() == 500 ) errorsAndWarnings.AddReference(new XmlParserMessage(XmlParserMessageType::error, "Too many error. Stopping"_XS8), true); return false; } public: @@ -85,18 +99,23 @@ public: int getLine() { return currentPos.line; } int getCol() { return currentPos.col; } - XObjArray& getErrorsAndWarnings() { return errorsAndWarnings; } + XObjArray& getXmlParserMessageArray() { return errorsAndWarnings; } // Add warning, error and xml error always return false so you can return addWarning(...) from validate function - XBool addWarning(XBool generateErrors, const XString8& warning) { if ( generateErrors ) AddErrorOrWarning(new XmlParserMessage(false, warning)); return false; } - XBool addError(XBool generateErrors, const XString8& warning) { if ( generateErrors ) AddErrorOrWarning(new XmlParserMessage(true, warning)); return false; } + XBool addInfo(XBool generateErrors, const XString8& warning) { if ( generateErrors ) AddXmlParserMessage(new XmlParserMessage(XmlParserMessageType::info, warning)); return false; } + XBool addWarning(XBool generateErrors, const XString8& warning) { if ( generateErrors ) AddXmlParserMessage(new XmlParserMessage(XmlParserMessageType::warning, warning)); return false; } + XBool addError(XBool generateErrors, const XString8& warning) { if ( generateErrors ) AddXmlParserMessage(new XmlParserMessage(XmlParserMessageType::error, warning)); return false; } // Xml stuctural error. Parsing should probably stop. XBool addXmlError(XBool generateErrors, const XString8& warning) { - if ( generateErrors ) {xmlParsingError = true; AddErrorOrWarning(new XmlParserMessage(true, warning));} + if ( generateErrors ) {xmlParsingError = true; AddXmlParserMessage(new XmlParserMessage(XmlParserMessageType::error, warning));} return false; } - void printfErrorsAndWarnings() { - for ( size_t idx = 0 ; idx < getErrorsAndWarnings().size() ; idx++ ) { - printf("%s: %s\n", getErrorsAndWarnings()[idx].isError ? "Error" : "Warning", getErrorsAndWarnings()[idx].msg.c_str()); + void printfXmlParserMessage() { + for ( size_t idx = 0 ; idx < getXmlParserMessageArray().size() ; idx++ ) { + printf("%s: %s\n", getXmlParserMessageArray()[idx].type == XmlParserMessageType::error ? "Error" + : getXmlParserMessageArray()[idx].type == XmlParserMessageType::warning ? "Warning" + : getXmlParserMessageArray()[idx].type == XmlParserMessageType::info ? "Info" + : "" + , getXmlParserMessageArray()[idx].msg.c_str()); } } diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h b/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h index 1294a1a64..058c977a9 100755 --- a/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h @@ -154,7 +154,7 @@ public: virtual const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return xstring8; } - virtual XBool setStringValue(const ValueType& _value) { setDefined(); xstring8 = _value; return true; } + virtual XBool setStringValue(const LString8& _value) { setDefined(); xstring8 = _value; return true; } virtual XBool setStringValue(const char* s, size_t size) { setDefined(); xstring8.strsicpy(s, size); return true; } virtual XBool stealStringValue(char* s, size_t size) { setDefined(); xstring8.stealValueFrom(s, size); return true; } @@ -228,7 +228,9 @@ class XmlString8Trimed : public XmlString8 public: XmlString8Trimed() : super(false) {}; XmlString8Trimed(XBool allowEmpty) : super(allowEmpty) {}; - virtual XBool setStringValue(const char* s, size_t size) override { setDefined(); xstring8.strsicpy(s, size); xstring8.trim(); return true; } + virtual XBool setStringValue(const LString8& _value) override { xstring8 = _value; xstring8.trim(); if ( !xstring8.isEmpty() ) setDefined(); return true; } + virtual XBool setStringValue(const char* s, size_t size) override { xstring8.strsicpy(s, size); xstring8.trim(); if ( !xstring8.isEmpty() ) setDefined(); return true; } + virtual XBool stealStringValue(char* s, size_t size) override { xstring8.stealValueFrom(s, size); xstring8.trim(); if ( !xstring8.isEmpty() ) setDefined(); return true; } }; class XmlKey : public XmlAbstractType diff --git a/rEFIt_UEFI/cpp_unit_test/config-test.cpp b/rEFIt_UEFI/cpp_unit_test/config-test.cpp index 3643d1220..c5d13cd55 100755 --- a/rEFIt_UEFI/cpp_unit_test/config-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/config-test.cpp @@ -916,9 +916,8 @@ int config_plist_tests() xmlLiteParser.init(config_test, strlen(config_test)); b = configPlistTest.parse(&xmlLiteParser, LString8("main")); - for ( size_t idx = 0 ; idx < xmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) { - if ( !xmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Warning: %s\n", xmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str()); - if ( xmlLiteParser.getErrorsAndWarnings()[idx].isError) printf("Error: %s\n", xmlLiteParser.getErrorsAndWarnings()[idx].msg.c_str()); + for ( size_t idx = 0 ; idx < xmlLiteParser.getXmlParserMessageArray().size() ; idx++ ) { + printf("%s\n", xmlLiteParser.getXmlParserMessageArray()[idx].getFormattedMsg().c_str()); } if ( !b ) { return breakpoint(102); diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp index c9f21f576..49b85ecbd 100755 --- a/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp @@ -49,7 +49,7 @@ for ( size_t idx = 0 ; idx < dict.valueArray().size() ; idx++ ) { printf("%s %s\n", dict.valueArray()[idx].key().c_str(), dict.valueArray()[idx].value().c_str()); } if ( !b ) return breakpoint(1); - if ( gXmlLiteParser.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParser.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); // if ( mainDict.arrayValue()[0].key() != "key1.1"_XS8 ) return breakpoint(14); // if ( mainDict.arrayValue()[0].value() != "foo1.1"_XS8 ) return breakpoint(14); // if ( mainDict.arrayValue()[1].key() != "key1.2"_XS8 ) return breakpoint(14); @@ -119,13 +119,13 @@ int repeatingdict_test2() gXmlLiteParser.init(config_test); b = dict.parseFromXmlLite(&gXmlLiteParser, "/"_XS8, true); -gXmlLiteParser.printfErrorsAndWarnings(); +gXmlLiteParser.getXmlParserMessageArray(); for ( size_t idx = 0 ; idx < dict.valueArray().size() ; idx++ ) { auto item = dict.valueArray()[idx]; printf("%s %d %s\n", dict.valueArray()[idx].key().c_str(), (bool)dict.valueArray()[idx].xmlBool.value(), dict.valueArray()[idx].xmlString.value().c_str()); } if ( !b ) return breakpoint(1); - if ( gXmlLiteParser.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParser.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); if ( dict.valueArray()[0].xmlBool.value() != true ) return breakpoint(14); if ( dict.valueArray()[0].xmlString.value() != "foo2.1"_XS8 ) return breakpoint(14); if ( dict.valueArray()[1].xmlBool.value() != false ) return breakpoint(14); diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp index d1d2489b8..3df1e7412 100755 --- a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp @@ -69,58 +69,58 @@ int getNextTag_tests() if ( !isClosingTag ) return breakpoint(15); // - // Test xmlLiteParser.getErrorsAndWarnings() + // Test xmlLiteParser.getXmlParserMessageArray() // gXmlLiteParserTest.init("foo1\n foo2"); gXmlLiteParserTest.moveForwardUntil(0); b = gXmlLiteParserTest.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 2 col 7") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 2 col 7") ) return breakpoint(14); gXmlLiteParserTest.init("foo1\n bar1"); gXmlLiteParserTest.moveForwardUntil('b'); b = gXmlLiteParserTest.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 2 col 3") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 2 col 3") ) return breakpoint(14); gXmlLiteParserTest.init("foo1\n "); gXmlLiteParserTest.moveForwardUntil('<'); b = gXmlLiteParserTest.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 2 col 9") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 2 col 9") ) return breakpoint(14); gXmlLiteParserTest.init("foo1\n "); gXmlLiteParserTest.moveForwardUntil('<'); b = gXmlLiteParserTest.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); if ( b ) return breakpoint(13); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 2 col 13") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 2 col 13") ) return breakpoint(14); gXmlLiteParserTest.init("foo1\n\nk"); gXmlLiteParserTest.moveForwardUntilSignificant(); b = gXmlLiteParserTest.getSimpleTag(&tag, &tagLength, &value, &valueLength, "key", true); if ( b ) return breakpoint(4); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 3 col 3") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 3 col 3") ) return breakpoint(14); gXmlLiteParserTest.init("\n\n k"); gXmlLiteParserTest.moveForwardUntilSignificant(); b = gXmlLiteParserTest.getSimpleTag(&tag, &tagLength, &value, &valueLength, "key", true); if ( b ) return breakpoint(4); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 3 col 5") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 3 col 5") ) return breakpoint(14); gXmlLiteParserTest.init("\n\n "); gXmlLiteParserTest.moveForwardUntilSignificant(); @@ -191,15 +191,15 @@ int getSimpleTag_tests() gXmlLiteParserTest.moveForwardUntilSignificant(); b = gXmlLiteParserTest.getSimpleTag(&tag, &tagLength, &value, &valueLength, "key", true); if ( b ) return breakpoint(4); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 3 col 11") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 3 col 11") ) return breakpoint(14); gXmlLiteParserTest.init("\n\n v"); gXmlLiteParserTest.moveForwardUntilSignificant(); b = gXmlLiteParserTest.getSimpleTag(&tag, &tagLength, &value, &valueLength, "key", true); if ( b ) return breakpoint(4); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 3 col 11") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 3 col 11") ) return breakpoint(14); return 0; } @@ -261,9 +261,9 @@ int skip_tests() gXmlLiteParserTest.init("vfoo"); // 'foo' is text after closing tag -> fail b = gXmlLiteParserTest.skipUntilClosingTag("key", strlen("key"), true); if ( b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); -auto msg = gXmlLiteParserTest.getErrorsAndWarnings()[0].msg; - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 1 col 25") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); +auto msg = gXmlLiteParserTest.getXmlParserMessageArray()[0].msg; + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 1 col 25") ) return breakpoint(14); gXmlLiteParserTest.init("v"); // is the next tag -> success b = gXmlLiteParserTest.skipUntilClosingTag("key", strlen("key"), true); @@ -285,15 +285,15 @@ auto msg = gXmlLiteParserTest.getErrorsAndWarnings()[0].msg; gXmlLiteParserTest.moveForwardUntil('k'); b = gXmlLiteParserTest.skipUntilClosingTag("key", strlen("key"), true); if ( b ) return breakpoint(2); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 4 col 2") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 4 col 2") ) return breakpoint(14); // Cannot have a tag containing chars AND subtag gXmlLiteParserTest.init("vk"); b = gXmlLiteParserTest.skipUntilClosingTag("key", strlen("key"), true); if ( b ) return breakpoint(2); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 1 col 19") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 1 col 19") ) return breakpoint(14); // Cannot have a tag containing chars AND subtag @@ -301,8 +301,8 @@ auto msg = gXmlLiteParserTest.getErrorsAndWarnings()[0].msg; gXmlLiteParserTest.moveForwardUntil('<'); b = gXmlLiteParserTest.skipNextTag(true); if ( b ) return breakpoint(2); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(13); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("line 2 col 2") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(13); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("line 2 col 2") ) return breakpoint(14); return 0; } @@ -430,18 +430,18 @@ int validate_dict_tests() gXmlLiteParserTest.init(config_test); b = mainDict.parseFromXmlLite(&gXmlLiteParserTest, "/"_XS8, true); -//gXmlLiteParser.printfErrorsAndWarnings(); +//gXmlLiteParser.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("Test1Bool tag") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("Test1Bool tag") ) return breakpoint(14); if ( !b ) return breakpoint(1); gXmlLiteParserTest.init(config_test); mainDict.validate(&gXmlLiteParserTest, "/"_XS8, XmlParserPosition(), true); -//gXmlLiteParser.printfErrorsAndWarnings(); +//gXmlLiteParser.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("ict1 tag") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("ict1 tag") ) return breakpoint(14); return 0; } @@ -483,17 +483,17 @@ int validate_array_tests() gXmlLiteParserTest.init(config_test); b = mainDict.parseFromXmlLite(&gXmlLiteParserTest, "/"_XS8, true); -//gXmlLiteParser.printfErrorsAndWarnings(); +//gXmlLiteParser.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("Expecting ") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("Expecting ") ) return breakpoint(14); gXmlLiteParserTest.init(config_test); mainDict.validate(&gXmlLiteParserTest, "/"_XS8, XmlParserPosition(), true); -//gXmlLiteParser.printfErrorsAndWarnings(); +//gXmlLiteParser.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 1 ) return breakpoint(1); - if ( !gXmlLiteParserTest.getErrorsAndWarnings()[0].msg.contains("dict2 tag") ) return breakpoint(14); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 1 ) return breakpoint(1); + if ( !gXmlLiteParserTest.getXmlParserMessageArray()[0].msg.contains("dict2 tag") ) return breakpoint(14); return 0; } @@ -534,9 +534,9 @@ int documentation_test1() gXmlLiteParserTest.moveForwardUntilSignificant(); gXmlLiteParserTest.skipHeader(); b = MyDict.parseFromXmlLite(&gXmlLiteParserTest, "/"_XS8, true); -gXmlLiteParserTest.printfErrorsAndWarnings(); +gXmlLiteParserTest.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); return 0; } @@ -586,9 +586,9 @@ int documentation_test2() b = MyDict.parse(config_test, strlen(config_test), "/"_XS8, &gXmlLiteParserTest); -gXmlLiteParserTest.printfErrorsAndWarnings(); +gXmlLiteParserTest.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); return 0; } @@ -638,9 +638,9 @@ int documentation_test3() b = MyDict.parse(config_test, strlen(config_test), "/"_XS8, &gXmlLiteParserTest); -gXmlLiteParserTest.printfErrorsAndWarnings(); +gXmlLiteParserTest.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); return 0; } @@ -723,9 +723,9 @@ int documentation_test4() b = MyDict.parse(config_test, strlen(config_test), "/"_XS8, &gXmlLiteParserTest); -gXmlLiteParserTest.printfErrorsAndWarnings(); +gXmlLiteParserTest.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); return 0; } @@ -792,9 +792,9 @@ int documentation_test5() b = MyDict.parse(config_test, strlen(config_test), "/"_XS8, &gXmlLiteParserTest); -gXmlLiteParserTest.printfErrorsAndWarnings(); +gXmlLiteParserTest.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); return 0; } @@ -830,9 +830,9 @@ int documentation_test6() b = MyDict.parse(config_test, strlen(config_test), "/"_XS8, &gXmlLiteParserTest); -gXmlLiteParserTest.printfErrorsAndWarnings(); +gXmlLiteParserTest.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); return 0; } @@ -871,9 +871,9 @@ int documentation_test7() b = MyDict.parse(config_test, strlen(config_test), "/"_XS8, &gXmlLiteParserTest); -gXmlLiteParserTest.printfErrorsAndWarnings(); +gXmlLiteParserTest.printfXmlParserMessage(); if ( !b ) return breakpoint(1); - if ( gXmlLiteParserTest.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); + if ( gXmlLiteParserTest.getXmlParserMessageArray().size() != 0 ) return breakpoint(1); XObjArray> array = MyDict.keyIntPairs.valueArray(); XString8 keyOne = array[1].key(); diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 8e40c5453..6f69b6670 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -357,9 +357,9 @@ void FillInputs(XBool New) InputItems[InputItemsCount].ItemType = Decimal; //85 InputItems[InputItemsCount++].SValue.SWPrintf("%d", gSettings.Smbios.ChassisType); InputItems[InputItemsCount].ItemType = ASString; //86 - InputItems[InputItemsCount++].SValue.SWPrintf("%s", GlobalConfig.BiosVersionUsed.c_str()); + InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.BiosVersion.c_str()); InputItems[InputItemsCount].ItemType = ASString; //87 - InputItems[InputItemsCount++].SValue.SWPrintf("%s", GlobalConfig.ReleaseDateUsed.c_str()); + InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.BiosReleaseDate.c_str()); InputItems[InputItemsCount].ItemType = BoolValue; //88 InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.DoubleFirstState; @@ -433,7 +433,7 @@ void FillInputs(XBool New) InputItems[InputItemsCount++].IValue = 116; InputItems[InputItemsCount].ItemType = ASString; //117 - InputItems[InputItemsCount++].SValue.SWPrintf("%s", GlobalConfig.EfiVersionUsed.c_str()); + InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.EfiVersion.c_str()); InputItems[InputItemsCount].ItemType = ASString; //118 InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.RtVariables.BooterCfgStr.c_str()); @@ -806,8 +806,8 @@ void ApplyInputs(void) // let's fill all other fields based on this ProductName // to serve as default Model = GetModelFromString(gSettings.Smbios.ProductName); - if (Model != MaxMachineType) { - SetDMISettingsForModel(Model, &gSettings, &GlobalConfig); + if (Model != MaxMacModel) { + SetDMISettingsForModel(Model, &gSettings); } } @@ -841,11 +841,11 @@ void ApplyInputs(void) } i++; //86 if (InputItems[i].Valid) { - GlobalConfig.BiosVersionUsed = InputItems[i].SValue; + gSettings.Smbios.BiosVersion = InputItems[i].SValue; } i++; //87 if (InputItems[i].Valid) { - GlobalConfig.ReleaseDateUsed = InputItems[i].SValue; + gSettings.Smbios.BiosReleaseDate = InputItems[i].SValue; } i++; //88 @@ -1016,7 +1016,7 @@ void ApplyInputs(void) } i++; //117 if (InputItems[i].Valid) { - GlobalConfig.EfiVersionUsed = InputItems[i].SValue; + gSettings.Smbios.EfiVersion = InputItems[i].SValue; } i++; //118 if (InputItems[i].Valid) {