mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 14:50:10 -06:00
cmVSSetupHelper: Fix SmartBSTR copy operations
Fix the SmartBSTR copy constructor and copy assignment operator added by
commit 18c8278b62 (VS: Add helper class to interact with Visual Studio
Installer, 2016-12-14, v3.8.0-rc1~93^2~4) to use the string from the
source of the copy.
Issue: #19610
This commit is contained in:
@@ -77,7 +77,8 @@ public:
|
|||||||
SmartBSTR(const SmartBSTR& src)
|
SmartBSTR(const SmartBSTR& src)
|
||||||
{
|
{
|
||||||
if (src.str != NULL) {
|
if (src.str != NULL) {
|
||||||
str = ::SysAllocStringByteLen((char*)str, ::SysStringByteLen(str));
|
str =
|
||||||
|
::SysAllocStringByteLen((char*)src.str, ::SysStringByteLen(src.str));
|
||||||
} else {
|
} else {
|
||||||
str = ::SysAllocStringByteLen(NULL, 0);
|
str = ::SysAllocStringByteLen(NULL, 0);
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,8 @@ public:
|
|||||||
if (str != src.str) {
|
if (str != src.str) {
|
||||||
::SysFreeString(str);
|
::SysFreeString(str);
|
||||||
if (src.str != NULL) {
|
if (src.str != NULL) {
|
||||||
str = ::SysAllocStringByteLen((char*)str, ::SysStringByteLen(str));
|
str =
|
||||||
|
::SysAllocStringByteLen((char*)src.str, ::SysStringByteLen(src.str));
|
||||||
} else {
|
} else {
|
||||||
str = ::SysAllocStringByteLen(NULL, 0);
|
str = ::SysAllocStringByteLen(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user