diff --git a/Xcode/cpp_tests/src/main.cpp b/Xcode/cpp_tests/src/main.cpp index 969bbf638..1bddebcd1 100755 --- a/Xcode/cpp_tests/src/main.cpp +++ b/Xcode/cpp_tests/src/main.cpp @@ -110,7 +110,7 @@ public: template class MutableRef : public T { public: - T* t; + const T* t; const T& operator = (const T* other) { t = other; return *t; @@ -133,7 +133,7 @@ extern "C" int main(int argc, const char * argv[]) Background = &test; test = 6; - float test2 = Background.get(); + float test2 = Background.get(); (void)test2; Test t; TestWithOverride t1; diff --git a/rEFIt_UEFI/Settings/ConfigManager.cpp b/rEFIt_UEFI/Settings/ConfigManager.cpp index 8be286bd1..77aca3408 100644 --- a/rEFIt_UEFI/Settings/ConfigManager.cpp +++ b/rEFIt_UEFI/Settings/ConfigManager.cpp @@ -438,8 +438,9 @@ void ConfigManager::DiscoverDevices() hda->controller_device_id = Pci.Hdr.DeviceId; // HDA Controller Info - HdaControllerGetName(((hda->controller_device_id << 16) | hda->controller_vendor_id), &hda->controller_name); - + CHAR16* name; + HdaControllerGetName(((hda->controller_device_id << 16) | hda->controller_vendor_id), &name); + hda->controller_name.stealValueFrom(name, wcslen(name) + 1); // we "steal" the value of name, so we sace one memory allocation, and we don't have de free. if (IsHDMIAudio(HandleArray[Index])) { DBG(" - HDMI Audio: \n"); diff --git a/rEFIt_UEFI/Settings/ConfigManager.h b/rEFIt_UEFI/Settings/ConfigManager.h index 81642f99c..c499a2bbb 100644 --- a/rEFIt_UEFI/Settings/ConfigManager.h +++ b/rEFIt_UEFI/Settings/ConfigManager.h @@ -90,7 +90,7 @@ class DiscoveredHdaProperties public: UINT16 controller_vendor_id = 0; UINT16 controller_device_id = 0; - CHAR16 *controller_name = 0; + XStringW controller_name = XStringW(); DiscoveredHdaProperties() {} }; diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 19628a221..1dffabc26 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -1696,7 +1696,7 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio() for (UINTN i = 0 ; i < gConf.HdaPropertiesArray.size() ; i++) { SubScreen->AddMenuInfoLine_f("%llu) %ls [%04hX][%04hX]", (i+1), - gConf.HdaPropertiesArray[i].controller_name, + gConf.HdaPropertiesArray[i].controller_name.wc_str(), gConf.HdaPropertiesArray[i].controller_vendor_id, gConf.HdaPropertiesArray[i].controller_device_id );