Replace std::auto_ptr with std::unique_ptr #619

This commit is contained in:
Alex Fabijanic
2017-10-10 18:17:49 -05:00
parent ad1b75b30e
commit 726bcc9202
4 changed files with 6 additions and 10 deletions

View File

@@ -87,11 +87,7 @@ protected:
private: private:
TestMethod _test; TestMethod _test;
#if __cplusplus < 201103L
std::auto_ptr<Fixture> _fixture;
#else
std::unique_ptr<Fixture> _fixture; std::unique_ptr<Fixture> _fixture;
#endif
}; };

View File

@@ -79,7 +79,7 @@ int main(int argc, char** argv)
try try
{ {
URI uri(argv[1]); URI uri(argv[1]);
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri)); std::unique_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
StreamCopier::copyStream(*pStr.get(), std::cout); StreamCopier::copyStream(*pStr.get(), std::cout);
} }
catch (Exception& exc) catch (Exception& exc)

View File

@@ -48,7 +48,7 @@ void HTTPSStreamFactoryTest::testNoRedirect()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/large"); URI uri("https://127.0.0.1/large");
uri.setPort(server.port()); uri.setPort(server.port());
std::auto_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assert (ostr.str() == HTTPSTestServer::LARGE_BODY); assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
@@ -61,7 +61,7 @@ void HTTPSStreamFactoryTest::testEmptyPath()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1"); URI uri("https://127.0.0.1");
uri.setPort(server.port()); uri.setPort(server.port());
std::auto_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assert (ostr.str() == HTTPSTestServer::SMALL_BODY); assert (ostr.str() == HTTPSTestServer::SMALL_BODY);
@@ -74,7 +74,7 @@ void HTTPSStreamFactoryTest::testRedirect()
HTTPSStreamFactory factory; HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/redirect"); URI uri("https://127.0.0.1/redirect");
uri.setPort(server.port()); uri.setPort(server.port());
std::auto_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assert (ostr.str() == HTTPSTestServer::LARGE_BODY); assert (ostr.str() == HTTPSTestServer::LARGE_BODY);
@@ -94,7 +94,7 @@ void HTTPSStreamFactoryTest::testProxy()
Application::instance().config().getInt("testsuite.proxy.port") Application::instance().config().getInt("testsuite.proxy.port")
); );
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt"); URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
std::auto_ptr<std::istream> pStr(factory.open(uri)); std::unique_ptr<std::istream> pStr(factory.open(uri));
std::ostringstream ostr; std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr); StreamCopier::copyStream(*pStr.get(), ostr);
assert(ostr.str().length() > 0); assert(ostr.str().length() > 0);

View File

@@ -49,7 +49,7 @@ namespace
try try
{ {
WebSocket ws(request, response); WebSocket ws(request, response);
std::auto_ptr<char> pBuffer(new char[_bufSize]); std::unique_ptr<char> pBuffer(new char[_bufSize]);
int flags; int flags;
int n; int n;
do do