Check that the file successfully loaded, use the length read for the conversion.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c2697b8719
commit
9efe0302c3
@ -2549,8 +2549,10 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
|
||||
#if wxUSE_UNICODE
|
||||
wxMemoryBuffer buffer(len+1);
|
||||
success = (file.Read(buffer.GetData(), len) == len);
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent);
|
||||
if (success) {
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent, len);
|
||||
}
|
||||
#else
|
||||
wxString buffer;
|
||||
success = (file.Read(wxStringBuffer(buffer, len), len) == len);
|
||||
|
@ -358,8 +358,10 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
|
||||
#if wxUSE_UNICODE
|
||||
wxMemoryBuffer buffer(len+1);
|
||||
success = (file.Read(buffer.GetData(), len) == len);
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent);
|
||||
if (success) {
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent, len);
|
||||
}
|
||||
#else
|
||||
wxString buffer;
|
||||
success = (file.Read(wxStringBuffer(buffer, len), len) == len);
|
||||
|
@ -2549,8 +2549,10 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
|
||||
#if wxUSE_UNICODE
|
||||
wxMemoryBuffer buffer(len+1);
|
||||
success = (file.Read(buffer.GetData(), len) == len);
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent);
|
||||
if (success) {
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent, len);
|
||||
}
|
||||
#else
|
||||
wxString buffer;
|
||||
success = (file.Read(wxStringBuffer(buffer, len), len) == len);
|
||||
|
@ -358,8 +358,10 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
|
||||
#if wxUSE_UNICODE
|
||||
wxMemoryBuffer buffer(len+1);
|
||||
success = (file.Read(buffer.GetData(), len) == len);
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent);
|
||||
if (success) {
|
||||
((char*)buffer.GetData())[len] = 0;
|
||||
contents = wxString(buffer, *wxConvCurrent, len);
|
||||
}
|
||||
#else
|
||||
wxString buffer;
|
||||
success = (file.Read(wxStringBuffer(buffer, len), len) == len);
|
||||
|
Loading…
Reference in New Issue
Block a user