Don't call strlen() unnecessarily in wxFFile::Write().
We already have the length of the string, either in the buffer if we actually converted the string from Unicode to multi-byte, or in the string itself in non-Unicode build. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -157,7 +157,12 @@ bool wxFFile::Write(const wxString& s, const wxMBConv& conv)
|
|||||||
if ( !buf )
|
if ( !buf )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const size_t size = strlen(buf); // FIXME: use buf.length() when available
|
#if wxUSE_UNICODE
|
||||||
|
const size_t size = buf.length();
|
||||||
|
#else
|
||||||
|
const size_t size = s.length();
|
||||||
|
#endif
|
||||||
|
|
||||||
return Write(buf, size) == size;
|
return Write(buf, size) == size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user