Don't unnecessarily NUL-terminate wxCharBuffer contents.
wxCharBuffer already initializes the last byte of the buffer it allocates to 0 so there is no need to do it explicitly. Also don't allocate an extra byte, wxCharBuffer already adds one to the length passed to it for the trailing NUL. See #13885. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -154,9 +154,8 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
|
||||
else
|
||||
{
|
||||
size_t size = s->GetSize();
|
||||
wxCharBuffer buf( size+1 );
|
||||
wxCharBuffer buf( size );
|
||||
s->Read( buf.data(), size );
|
||||
*(buf.data() + size) = 0;
|
||||
wxString tmpdoc( buf, wxConvISO8859_1);
|
||||
|
||||
wxString charset = wxHtmlParser::ExtractCharsetInformation(tmpdoc);
|
||||
|
||||
Reference in New Issue
Block a user