git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6272
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxString wxTextCtrl::GetLineText(long lineNo) const
{
+ // TODO this should probably be optimized by using GetWriteBuf()
+
size_t len = (size_t)GetLineLength(lineNo) + 1;
+ if ( len < sizeof(WORD) )
+ {
+ // there must be at least enough place for the length WORD in the
+ // buffer
+ len += sizeof(WORD);
+ }
+
char *buf = (char *)malloc(len);
*(WORD *)buf = len;
int noChars = (int)SendMessage(GetHwnd(), EM_GETLINE, lineNo, (LPARAM)buf);