Skip to content

Commit

Permalink
[ATL] Implement CSimpleStringT::Preallocate (reactos#6574)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SigmaTel71 authored Mar 5, 2024
1 parent 4dc4ec2 commit c30b284
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdk/lib/atl/atlsimpstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ class CSimpleStringT
return m_pszData;
}

void Preallocate(_In_ int nLength)
{
PrepareWrite(nLength);
}

void ReleaseBufferSetLength(_In_ int nNewLength)
{
ATLASSERT(nNewLength >= 0);
Expand Down

0 comments on commit c30b284

Please sign in to comment.