From c78b1fa01c4625b49cf9d466d1dd9914826e3b06 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Jun 2014 01:00:10 +0000 Subject: [PATCH] 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 --- src/common/ffile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index 0f479565d2..64dc25e3f1 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -157,7 +157,12 @@ bool wxFFile::Write(const wxString& s, const wxMBConv& conv) if ( !buf ) 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; }