Use wxScopedPtr<> instead of std::auto_ptr<> in the tests

It is better to use wholly non-standard wxWidgets smart pointer class
rather than using standard, but deprecated in C++17, std::auto_ptr<> as
this results in warnings from recent compilers.
This commit is contained in:
Vadim Zeitlin
2017-10-31 21:14:05 +01:00
parent 9d0df5707a
commit b8c9cd3528

View File

@@ -32,6 +32,7 @@
#endif #endif
#include "wx/filename.h" #include "wx/filename.h"
#include "wx/scopedptr.h"
#include "wx/wfstream.h" #include "wx/wfstream.h"
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@@ -51,8 +52,6 @@
#define fileno _fileno #define fileno _fileno
#endif #endif
using std::auto_ptr;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Helpers // Helpers
@@ -120,7 +119,7 @@ void LargeFileTest::runTest()
// write a large file // write a large file
{ {
auto_ptr<wxOutputStream> out(MakeOutStream(tmpfile.m_name)); wxScopedPtr<wxOutputStream> out(MakeOutStream(tmpfile.m_name));
// write 'A's at [ 0x7fffffbf, 0x7fffffff [ // write 'A's at [ 0x7fffffbf, 0x7fffffff [
pos = 0x7fffffff - size; pos = 0x7fffffff - size;
@@ -154,7 +153,7 @@ void LargeFileTest::runTest()
// read the large file back // read the large file back
{ {
auto_ptr<wxInputStream> in(MakeInStream(tmpfile.m_name)); wxScopedPtr<wxInputStream> in(MakeInStream(tmpfile.m_name));
char buf[size]; char buf[size];
if (haveLFS) { if (haveLFS) {
@@ -218,7 +217,7 @@ protected:
wxInputStream *LargeFileTest_wxFile::MakeInStream(const wxString& name) const wxInputStream *LargeFileTest_wxFile::MakeInStream(const wxString& name) const
{ {
auto_ptr<wxFileInputStream> in(new wxFileInputStream(name)); wxScopedPtr<wxFileInputStream> in(new wxFileInputStream(name));
CPPUNIT_ASSERT(in->IsOk()); CPPUNIT_ASSERT(in->IsOk());
return in.release(); return in.release();
} }
@@ -250,7 +249,7 @@ protected:
wxInputStream *LargeFileTest_wxFFile::MakeInStream(const wxString& name) const wxInputStream *LargeFileTest_wxFFile::MakeInStream(const wxString& name) const
{ {
auto_ptr<wxFFileInputStream> in(new wxFFileInputStream(name)); wxScopedPtr<wxFFileInputStream> in(new wxFFileInputStream(name));
CPPUNIT_ASSERT(in->IsOk()); CPPUNIT_ASSERT(in->IsOk());
return in.release(); return in.release();
} }