From 436d27baf09ecc666d1d3666c4bb54824821fe30 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 6 Dec 2017 03:40:02 +0100 Subject: [PATCH] Use correct length for the string returned from wxFile::ReadAll() This corrects f75387850b9672481d4d449403d973d92a8d3675 and just uses the newly added assign() overload taking the buffer directly: as the buffer already knows its length, this makes it unnecessary to pass it separately. Closes #16490. --- src/common/file.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/file.cpp b/src/common/file.cpp index 9da9aba608..0e976273dc 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -281,8 +281,7 @@ bool wxFile::ReadAll(wxString *str, const wxMBConv& conv) length -= nread; } - wxString strTmp(buf, conv, length); - str->swap(strTmp); + str->assign(buf, conv); return true; }