Don't use std::auto_ptr<> in the test to avoid warnings
When compiling with g++ or clang in C++11 mode, the use of std::auto_ptr<> triggers warnings about its deprecation, so replace it with wxScopedPtr<> as this is simpler than choosing between auto_ptr<> and unique_ptr<>.
This commit is contained in:
parent
35f35ea407
commit
b08985ac24
@ -20,13 +20,13 @@
|
||||
|
||||
#include "archivetest.h"
|
||||
#include "wx/dir.h"
|
||||
#include "wx/scopedptr.h"
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <sys/stat.h>
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
|
||||
|
||||
// Check whether member templates can be used
|
||||
@ -550,7 +550,7 @@ TestEntry& ArchiveTestCase<ClassFactoryT>::Add(const char *name,
|
||||
template <class ClassFactoryT>
|
||||
void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out)
|
||||
{
|
||||
auto_ptr<OutputStreamT> arc(m_factory->NewStream(out));
|
||||
wxScopedPtr<OutputStreamT> arc(m_factory->NewStream(out));
|
||||
TestEntries::iterator it;
|
||||
|
||||
OnCreateArchive(*arc);
|
||||
@ -578,7 +578,7 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out)
|
||||
|
||||
if ((choices & 2) || testEntry.IsText()) {
|
||||
// try PutNextEntry(EntryT *pEntry)
|
||||
auto_ptr<EntryT> entry(m_factory->NewEntry());
|
||||
wxScopedPtr<EntryT> entry(m_factory->NewEntry());
|
||||
entry->SetName(name, wxPATH_UNIX);
|
||||
if (setIsDir)
|
||||
entry->SetIsDir();
|
||||
@ -692,8 +692,8 @@ template <class ClassFactoryT>
|
||||
void ArchiveTestCase<ClassFactoryT>::ModifyArchive(wxInputStream& in,
|
||||
wxOutputStream& out)
|
||||
{
|
||||
auto_ptr<InputStreamT> arcIn(m_factory->NewStream(in));
|
||||
auto_ptr<OutputStreamT> arcOut(m_factory->NewStream(out));
|
||||
wxScopedPtr<InputStreamT> arcIn(m_factory->NewStream(in));
|
||||
wxScopedPtr<OutputStreamT> arcOut(m_factory->NewStream(out));
|
||||
EntryT *pEntry;
|
||||
|
||||
const wxString deleteName = wxT("bin/bin1000");
|
||||
@ -705,7 +705,7 @@ void ArchiveTestCase<ClassFactoryT>::ModifyArchive(wxInputStream& in,
|
||||
arcOut->CopyArchiveMetaData(*arcIn);
|
||||
|
||||
while ((pEntry = arcIn->GetNextEntry()) != NULL) {
|
||||
auto_ptr<EntryT> entry(pEntry);
|
||||
wxScopedPtr<EntryT> entry(pEntry);
|
||||
OnSetNotifier(*entry);
|
||||
wxString name = entry->GetName(wxPATH_UNIX);
|
||||
|
||||
@ -750,7 +750,7 @@ void ArchiveTestCase<ClassFactoryT>::ModifyArchive(wxInputStream& in,
|
||||
|
||||
// try adding a new entry
|
||||
TestEntry& testEntry = Add(newName.mb_str(), newData);
|
||||
auto_ptr<EntryT> newentry(m_factory->NewEntry());
|
||||
wxScopedPtr<EntryT> newentry(m_factory->NewEntry());
|
||||
newentry->SetName(newName);
|
||||
newentry->SetDateTime(testEntry.GetDateTime());
|
||||
newentry->SetSize(testEntry.GetLength());
|
||||
@ -773,7 +773,7 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in)
|
||||
typedef std::list<EntryPtr> Entries;
|
||||
typedef typename Entries::iterator EntryIter;
|
||||
|
||||
auto_ptr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
wxScopedPtr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
int expectedTotal = m_testEntries.size();
|
||||
EntryPtr entry;
|
||||
Entries entries;
|
||||
@ -982,7 +982,7 @@ void ArchiveTestCase<ClassFactoryT>::TestIterator(wxInputStream& in)
|
||||
typedef std::list<EntryT*> ArchiveCatalog;
|
||||
typedef typename ArchiveCatalog::iterator CatalogIter;
|
||||
|
||||
auto_ptr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
wxScopedPtr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
size_t count = 0;
|
||||
|
||||
#ifdef WXARC_MEMBER_TEMPLATES
|
||||
@ -994,7 +994,7 @@ void ArchiveTestCase<ClassFactoryT>::TestIterator(wxInputStream& in)
|
||||
#endif
|
||||
|
||||
for (CatalogIter it = cat.begin(); it != cat.end(); ++it) {
|
||||
auto_ptr<EntryT> entry(*it);
|
||||
wxScopedPtr<EntryT> entry(*it);
|
||||
count += m_testEntries.count(entry->GetName(wxPATH_UNIX));
|
||||
}
|
||||
|
||||
@ -1011,7 +1011,7 @@ void ArchiveTestCase<ClassFactoryT>::TestPairIterator(wxInputStream& in)
|
||||
typedef std::map<wxString, EntryT*> ArchiveCatalog;
|
||||
typedef typename ArchiveCatalog::iterator CatalogIter;
|
||||
|
||||
auto_ptr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
wxScopedPtr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
size_t count = 0;
|
||||
|
||||
#ifdef WXARC_MEMBER_TEMPLATES
|
||||
@ -1023,7 +1023,7 @@ void ArchiveTestCase<ClassFactoryT>::TestPairIterator(wxInputStream& in)
|
||||
#endif
|
||||
|
||||
for (CatalogIter it = cat.begin(); it != cat.end(); ++it) {
|
||||
auto_ptr<EntryT> entry(it->second);
|
||||
wxScopedPtr<EntryT> entry(it->second);
|
||||
count += m_testEntries.count(entry->GetName(wxPATH_UNIX));
|
||||
}
|
||||
|
||||
@ -1040,7 +1040,7 @@ void ArchiveTestCase<ClassFactoryT>::TestSmartIterator(wxInputStream& in)
|
||||
typedef typename ArchiveCatalog::iterator CatalogIter;
|
||||
typedef wxArchiveIterator<InputStreamT, Ptr<EntryT> > Iter;
|
||||
|
||||
auto_ptr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
wxScopedPtr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
|
||||
#ifdef WXARC_MEMBER_TEMPLATES
|
||||
ArchiveCatalog cat((Iter)*arc, Iter());
|
||||
@ -1071,7 +1071,7 @@ void ArchiveTestCase<ClassFactoryT>::TestSmartPairIterator(wxInputStream& in)
|
||||
typedef wxArchiveIterator<InputStreamT,
|
||||
std::pair<wxString, Ptr<EntryT> > > PairIter;
|
||||
|
||||
auto_ptr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
wxScopedPtr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
|
||||
#ifdef WXARC_MEMBER_TEMPLATES
|
||||
ArchiveCatalog cat((PairIter)*arc, PairIter());
|
||||
@ -1099,8 +1099,8 @@ void ArchiveTestCase<ClassFactoryT>::ReadSimultaneous(TestInputStream& in)
|
||||
|
||||
// create two archive input streams
|
||||
TestInputStream in2(in);
|
||||
auto_ptr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
auto_ptr<InputStreamT> arc2(m_factory->NewStream(in2));
|
||||
wxScopedPtr<InputStreamT> arc(m_factory->NewStream(in));
|
||||
wxScopedPtr<InputStreamT> arc2(m_factory->NewStream(in2));
|
||||
|
||||
// load the catalog
|
||||
#ifdef WXARC_MEMBER_TEMPLATES
|
||||
@ -1192,7 +1192,7 @@ protected:
|
||||
void CreateArchive(wxOutputStream& out);
|
||||
void ExtractArchive(wxInputStream& in);
|
||||
|
||||
auto_ptr<wxArchiveClassFactory> m_factory; // factory to make classes
|
||||
wxScopedPtr<wxArchiveClassFactory> m_factory; // factory to make classes
|
||||
int m_options; // test options
|
||||
};
|
||||
|
||||
@ -1232,7 +1232,7 @@ void CorruptionTestCase::runTest()
|
||||
|
||||
void CorruptionTestCase::CreateArchive(wxOutputStream& out)
|
||||
{
|
||||
auto_ptr<wxArchiveOutputStream> arc(m_factory->NewStream(out));
|
||||
wxScopedPtr<wxArchiveOutputStream> arc(m_factory->NewStream(out));
|
||||
|
||||
arc->PutNextDirEntry(wxT("dir"));
|
||||
arc->PutNextEntry(wxT("file"));
|
||||
@ -1241,8 +1241,8 @@ void CorruptionTestCase::CreateArchive(wxOutputStream& out)
|
||||
|
||||
void CorruptionTestCase::ExtractArchive(wxInputStream& in)
|
||||
{
|
||||
auto_ptr<wxArchiveInputStream> arc(m_factory->NewStream(in));
|
||||
auto_ptr<wxArchiveEntry> entry(arc->GetNextEntry());
|
||||
wxScopedPtr<wxArchiveInputStream> arc(m_factory->NewStream(in));
|
||||
wxScopedPtr<wxArchiveEntry> entry(arc->GetNextEntry());
|
||||
|
||||
while (entry.get() != NULL) {
|
||||
char buf[1024];
|
||||
@ -1250,8 +1250,7 @@ void CorruptionTestCase::ExtractArchive(wxInputStream& in)
|
||||
while (arc->IsOk())
|
||||
arc->Read(buf, sizeof(buf));
|
||||
|
||||
auto_ptr<wxArchiveEntry> next(arc->GetNextEntry());
|
||||
entry = next;
|
||||
entry.reset(arc->GetNextEntry());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user