mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 20:18:22 +00:00
[ATL] Add CString.AllocSysString
This commit is contained in:
parent
6c92d5c14a
commit
fa3e173515
1 changed files with 26 additions and 1 deletions
|
@ -143,6 +143,12 @@ public:
|
||||||
return ::vswprintf(pszDest, pszFormat, args);
|
return ::vswprintf(pszDest, pszFormat, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BSTR __cdecl AllocSysString(
|
||||||
|
_In_z_ LPCWSTR pszSource,
|
||||||
|
_In_ int nLength)
|
||||||
|
{
|
||||||
|
return ::SysAllocStringLen(pszSource, nLength);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -269,6 +275,19 @@ public:
|
||||||
return ::vsprintf(pszDest, pszFormat, args);
|
return ::vsprintf(pszDest, pszFormat, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BSTR __cdecl AllocSysString(
|
||||||
|
_In_z_ LPCSTR pszSource,
|
||||||
|
_In_ int nLength)
|
||||||
|
{
|
||||||
|
int nLen = ChTraitsCRT<wchar_t>::GetBaseTypeLength(pszSource, nLength);
|
||||||
|
BSTR bstr = ::SysAllocStringLen(NULL, nLen);
|
||||||
|
if (bstr)
|
||||||
|
{
|
||||||
|
ChTraitsCRT<wchar_t>::ConvertToBaseType(bstr, nLen, pszSource, nLength);
|
||||||
|
}
|
||||||
|
return bstr;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -797,6 +816,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BSTR AllocSysString() const
|
||||||
|
{
|
||||||
|
return StringTraits::AllocSysString(CThisSimpleString::GetString(), CThisSimpleString::GetLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace ATL
|
} //namespace ATL
|
||||||
|
|
Loading…
Reference in a new issue