[ATL] Implement CSimpleStringT::Preallocate (#6574)

Used in `ATL::CStringW` and `ATL::CStringA`, for example:

```
ATL::CStringW cswItemText = "";
cswItemText.Preallocate(64);

SendDlgItemMessageW(pdis->CtlID, LB_GETTEXT, pdis->itemID, reinterpret_cast<LPARAM>(cswItemText.GetBuffer()));
cswItemText.ReleaseBuffer();
```

This public function is used to allocate memory for the string via private PrepareWrite, but it's missing somehow. Now it shouldn't be.
This commit is contained in:
Vitaly Orekhov 2024-03-05 11:42:27 +03:00 committed by GitHub
parent 4dc4ec2fe4
commit c30b284373
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -373,6 +373,11 @@ public:
return m_pszData;
}
void Preallocate(_In_ int nLength)
{
PrepareWrite(nLength);
}
void ReleaseBufferSetLength(_In_ int nNewLength)
{
ATLASSERT(nNewLength >= 0);