Merge branch 'poco-1.10.0' of https://github.com/pocoproject/poco into poco-1.10.0

This commit is contained in:
Francis ANDRE 2019-12-17 10:10:01 +01:00
commit 4e87b69de4
19 changed files with 85 additions and 229 deletions

View File

@ -199,16 +199,6 @@ extern "C" int ApacheConnector_handler(request_rec *r)
const char* clientIp = r->connection->client_ip;
apr_port_t clientPort = r->connection->client_addr->port;
#endif
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec,
r->connection->local_ip,
r->connection->local_addr->port,
clientIp,
clientPort));
std::auto_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#else
std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec,
r->connection->local_ip,
@ -217,7 +207,6 @@ extern "C" int ApacheConnector_handler(request_rec *r)
clientPort));
std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
#endif // POCO_ENABLE_CPP11
// add header information to request
rec.copyHeaders(*pRequest);
@ -225,11 +214,7 @@ extern "C" int ApacheConnector_handler(request_rec *r)
try
{
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
#else
std::unique_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
#endif // POCO_ENABLE_CPP11
if (pHandler.get())
{

View File

@ -81,11 +81,7 @@ protected:
private:
TestMethod _test;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<Fixture> _fixture;
#else
std::unique_ptr<Fixture> _fixture;
#endif // POCO_ENABLE_CPP11
};

View File

@ -90,11 +90,7 @@ private:
void load(PKCS12* pPKCS12, const std::string& password = "");
std::string extractFriendlyName(X509* pCert);
#ifdef POCO_ENABLE_CPP11
typedef std::unique_ptr<X509Certificate> CertPtr;
#else
typedef std::auto_ptr<X509Certificate> CertPtr;
#endif // #ifdef POCO_ENABLE_CPP11
OpenSSLInitializer _openSSLInitializer;
EVP_PKEY* _pKey;

View File

@ -87,11 +87,7 @@ public:
FastMutex::ScopedLock lock(_mutex);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<AbstractFactory> ptr(pAbstractFactory);
#else
std::unique_ptr<AbstractFactory> ptr(pAbstractFactory);
#endif // POCO_ENABLE_CPP11
typename FactoryMap::iterator it = _map.find(className);
if (it == _map.end())

View File

@ -58,11 +58,7 @@ void pad(std::string& str, int precision, int width, char prefix = ' ', char dec
std::string::size_type frac = str.length() - decSepPos - 1;
std::string::size_type ePos = str.find_first_of("eE");
#ifdef POCO_ENABLE_CPP11
std::unique_ptr<std::string> eStr;
#else
std::auto_ptr<std::string> eStr;
#endif
if (ePos != std::string::npos)
{
eStr.reset(new std::string(str.substr(ePos, std::string::npos)));

View File

@ -66,13 +66,8 @@ void DynamicFactoryTest::testDynamicFactory()
assertTrue (!dynFactory.isClass("C"));
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A")));
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#else
std::unique_ptr<A> a(dynamic_cast<A*>(dynFactory.createInstance("A")));
std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#endif // POCO_ENABLE_CPP11
assertNotNull(a.get());
assertNotNull(b.get());
@ -92,11 +87,7 @@ void DynamicFactoryTest::testDynamicFactory()
try
{
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#else
std::unique_ptr<B> b(dynamic_cast<B*>(dynFactory.createInstance("B")));
#endif // POCO_ENABLE_CPP11
fail("unregistered - must throw");
}
catch (Poco::NotFoundException&)

View File

@ -111,11 +111,7 @@ void LoggingFactoryTest::testBuiltins()
void LoggingFactoryTest::testCustom()
{
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<LoggingFactory> fact(new LoggingFactory);
#else
std::unique_ptr<LoggingFactory> fact(new LoggingFactory);
#endif // POCO_ENABLE_CPP11
fact->registerChannelClass("CustomChannel", new Instantiator<CustomChannel, Channel>);
fact->registerFormatterClass("CustomFormatter", new Instantiator<CustomFormatter, Formatter>);

View File

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

View File

@ -76,11 +76,7 @@ void HTTPServerConnection::run()
response.set("Server", server);
try
{
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
#else
std::unique_ptr<HTTPRequestHandler> pHandler(_pFactory->createRequestHandler(request));
#endif
if (pHandler.get())
{
if (request.getExpectContinue() && response.getStatus() == HTTPResponse::HTTP_OK)

View File

@ -108,11 +108,7 @@ void TCPServerDispatcher::run()
TCPConnectionNotification* pCNf = dynamic_cast<TCPConnectionNotification*>(pNf.get());
if (pCNf)
{
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
#else
std::unique_ptr<TCPServerConnection> pConnection(_pConnectionFactory->createConnection(pCNf->socket()));
#endif // POCO_ENABLE_CPP11
poco_check_ptr(pConnection.get());
beginConnection();
pConnection->start();

View File

@ -79,11 +79,7 @@ void FTPStreamFactoryTest::testDownload()
uri.setPort(server.port());
uri.setPath("/test.txt;type=a");
FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr);
@ -120,11 +116,7 @@ void FTPStreamFactoryTest::testList()
uri.setPort(server.port());
uri.setPath("/usr/guest/data;type=d");
FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr);
@ -162,11 +154,7 @@ void FTPStreamFactoryTest::testUserInfo()
uri.setPath("/test.txt;type=a");
uri.setUserInfo("user:secret");
FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr);
@ -205,11 +193,7 @@ void FTPStreamFactoryTest::testPasswordProvider()
uri.setPath("/test.txt;type=a");
uri.setUserInfo("user");
FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream dataStr;
StreamCopier::copyStream(*pStr.get(), dataStr);
@ -239,11 +223,7 @@ void FTPStreamFactoryTest::testMissingPasswordProvider()
try
{
FTPStreamFactory sf;
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(sf.open(uri));
#else
std::unique_ptr<std::istream> pStr(sf.open(uri));
#endif // POCO_ENABLE_CPP11
fail("no password provider - must throw");
}
catch (FTPException&)

View File

@ -44,11 +44,7 @@ void HTTPStreamFactoryTest::testNoRedirect()
HTTPStreamFactory factory;
URI uri("http://127.0.0.1/large");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY);
@ -61,11 +57,7 @@ void HTTPStreamFactoryTest::testEmptyPath()
HTTPStreamFactory factory;
URI uri("http://127.0.0.1");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::SMALL_BODY);
@ -79,11 +71,7 @@ void HTTPStreamFactoryTest::testRedirect()
opener.registerStreamFactory("http", new HTTPStreamFactory);
URI uri("http://127.0.0.1/redirect");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(opener.open(uri));
#else
std::unique_ptr<std::istream> pStr(opener.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY);
@ -95,11 +83,7 @@ void HTTPStreamFactoryTest::testProxy()
HTTPTestServer server;
HTTPStreamFactory factory("127.0.0.1", server.port());
URI uri("http://www.somehost.com/large");
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPTestServer::LARGE_BODY);

View File

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

View File

@ -47,11 +47,7 @@ void HTTPSStreamFactoryTest::testNoRedirect()
HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/large");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -64,11 +60,7 @@ void HTTPSStreamFactoryTest::testEmptyPath()
HTTPSStreamFactory factory;
URI uri("https://127.0.0.1");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY);
@ -81,11 +73,7 @@ void HTTPSStreamFactoryTest::testRedirect()
HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/redirect");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -100,11 +88,7 @@ void HTTPSStreamFactoryTest::testProxy()
Application::instance().config().getInt("testsuite.proxy.port")
);
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str().length() > 0);

View File

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

View File

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

View File

@ -47,11 +47,7 @@ void HTTPSStreamFactoryTest::testNoRedirect()
HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/large");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -64,11 +60,7 @@ void HTTPSStreamFactoryTest::testEmptyPath()
HTTPSStreamFactory factory;
URI uri("https://127.0.0.1");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::SMALL_BODY);
@ -81,11 +73,7 @@ void HTTPSStreamFactoryTest::testRedirect()
HTTPSStreamFactory factory;
URI uri("https://127.0.0.1/redirect");
uri.setPort(server.port());
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str() == HTTPSTestServer::LARGE_BODY);
@ -100,11 +88,7 @@ void HTTPSStreamFactoryTest::testProxy()
Application::instance().config().getInt("testsuite.proxy.port")
);
URI uri("https://secure.appinf.com/public/poco/NetSSL.txt");
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<std::istream> pStr(factory.open(uri));
#else
std::unique_ptr<std::istream> pStr(factory.open(uri));
#endif // POCO_ENABLE_CPP11
std::ostringstream ostr;
StreamCopier::copyStream(*pStr.get(), ostr);
assertTrue (ostr.str().length() > 0);

View File

@ -295,11 +295,7 @@ protected:
p.setBaseName(clazz);
}
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
#else
std::unique_ptr<CodeWriter> pCodeWriter(createCodeWriter(page, clazz));
#endif
if (!_outputDir.empty())
{

View File

@ -303,11 +303,7 @@ protected:
void parse(const std::string& file)
{
logger().information("Preprocessing " + file);
#ifndef POCO_ENABLE_CPP11
std::auto_ptr<Preprocessor> pPreProc(preprocess(file));
#else
std::unique_ptr<Preprocessor> pPreProc(preprocess(file));
#endif // POCO_ENABLE_CPP11
logger().information("Parsing " + file);
if (pPreProc->stream().good())
{