fix off by 1 error in GetTextRaw() (#4317)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-06-15 12:08:52 +00:00
parent 0c9a798547
commit 949750de63
2 changed files with 6 additions and 6 deletions

View File

@@ -3692,8 +3692,8 @@ void wxStyledTextCtrl::SetTextRaw(const char* text)
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
{
int len = GetTextLength();
wxCharBuffer buf(len);
SendMsg(SCI_GETTEXT, len, (long)buf.data());
wxCharBuffer buf(len); // adds 1 for NUL automatically
SendMsg(SCI_GETTEXT, len + 1, (long)buf.data());
return buf;
}

View File

@@ -695,8 +695,8 @@ void wxStyledTextCtrl::SetTextRaw(const char* text)
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
{
int len = GetTextLength();
wxCharBuffer buf(len);
SendMsg(SCI_GETTEXT, len, (long)buf.data());
wxCharBuffer buf(len); // adds 1 for NUL automatically
SendMsg(SCI_GETTEXT, len + 1, (long)buf.data());
return buf;
}