From 5cd5c878ee3fc2782330bac6a4301639a231e468 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 1 Oct 2017 09:17:49 -0700 Subject: [PATCH] Avoid using wxString::ReadAll() on a file containing binary data ReadAll() does character set conversion, which will likely fail --- tests/file/filefn.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/file/filefn.cpp b/tests/file/filefn.cpp index 7669d03ad1..ac07189fb4 100644 --- a/tests/file/filefn.cpp +++ b/tests/file/filefn.cpp @@ -149,7 +149,7 @@ void FileFunctionsTestCase::GetTempFolder() void FileFunctionsTestCase::CopyFile() { - const wxString filename1(wxT("horse.bmp")); + const wxString filename1(wxS("horse.xpm")); const wxString& filename2 = m_fileNameWork; const std::string msg = @@ -166,8 +166,7 @@ void FileFunctionsTestCase::CopyFile() wxString s1, s2; CPPUNIT_ASSERT_MESSAGE( msg, f1.ReadAll(&s1) && f2.ReadAll(&s2) ); - CPPUNIT_ASSERT_MESSAGE( msg, (s1.length() == s2.length()) && - (memcmp(s1.c_str(), s2.c_str(), s1.length()) == 0) ); + CPPUNIT_ASSERT_MESSAGE( msg, s1 == s2 ); CPPUNIT_ASSERT_MESSAGE( msg, f1.Close() && f2.Close() ); CPPUNIT_ASSERT_MESSAGE( msg, wxRemoveFile(filename2) );