Merge pull request #1277 from vmiklos/net-tests-wshadow-fixes

GH #1050 Net tests: fix gcc -Wshadow warnings
This commit is contained in:
Günter Obiltschnig 2016-06-17 17:45:17 +02:00 committed by GitHub
commit 92fa1b1884
42 changed files with 83 additions and 83 deletions

View File

@ -57,9 +57,9 @@ class ParallelSocketAcceptor
public:
typedef Poco::Net::ParallelSocketReactor<SR> ParallelReactor;
explicit ParallelSocketAcceptor(ServerSocket& socket,
explicit ParallelSocketAcceptor(ServerSocket& rSocket,
unsigned threads = Poco::Environment::processorCount()):
_socket(socket),
_socket(rSocket),
_pReactor(0),
_threads(threads),
_next(0)
@ -69,11 +69,11 @@ public:
init();
}
ParallelSocketAcceptor(ServerSocket& socket,
SocketReactor& reactor,
ParallelSocketAcceptor(ServerSocket& rSocket,
SocketReactor& rReactor,
unsigned threads = Poco::Environment::processorCount()):
_socket(socket),
_pReactor(&reactor),
_socket(rSocket),
_pReactor(&rReactor),
_threads(threads),
_next(0)
/// Creates a ParallelSocketAcceptor using the given ServerSocket, sets the
@ -104,19 +104,19 @@ public:
}
}
void setReactor(SocketReactor& reactor)
void setReactor(SocketReactor& rReactor)
/// Sets the reactor for this acceptor.
{
_pReactor = &reactor;
_pReactor = &rReactor;
if (!_pReactor->hasEventHandler(_socket,
Poco::Observer<ParallelSocketAcceptor,
ReadableNotification>(*this, &ParallelSocketAcceptor::onAccept)))
{
registerAcceptor(reactor);
registerAcceptor(rReactor);
}
}
virtual void registerAcceptor(SocketReactor& reactor)
virtual void registerAcceptor(SocketReactor& rReactor)
/// Registers the ParallelSocketAcceptor with a SocketReactor.
///
/// A subclass can override this function to e.g.
@ -128,7 +128,7 @@ public:
if (_pReactor)
throw Poco::InvalidAccessException("Acceptor already registered.");
_pReactor = &reactor;
_pReactor = &rReactor;
_pReactor->addEventHandler(_socket,
Poco::Observer<ParallelSocketAcceptor,
ReadableNotification>(*this, &ParallelSocketAcceptor::onAccept));
@ -161,15 +161,15 @@ public:
}
protected:
virtual ServiceHandler* createServiceHandler(StreamSocket& socket)
virtual ServiceHandler* createServiceHandler(StreamSocket& rSocket)
/// Create and initialize a new ServiceHandler instance.
///
/// Subclasses can override this method.
{
std::size_t next = _next++;
std::size_t nextReactor = _next++;
if (_next == _reactors.size()) _next = 0;
_reactors[next]->wakeUp();
return new ServiceHandler(socket, *_reactors[next]);
_reactors[nextReactor]->wakeUp();
return new ServiceHandler(rSocket, *_reactors[nextReactor]);
}
SocketReactor* reactor()

View File

@ -69,16 +69,16 @@ class SocketAcceptor
/// if special steps are necessary to create a ServiceHandler object.
{
public:
explicit SocketAcceptor(ServerSocket& socket):
_socket(socket),
explicit SocketAcceptor(ServerSocket& rSocket):
_socket(rSocket),
_pReactor(0)
/// Creates a SocketAcceptor, using the given ServerSocket.
{
}
SocketAcceptor(ServerSocket& socket, SocketReactor& reactor):
_socket(socket),
_pReactor(&reactor)
SocketAcceptor(ServerSocket& rSocket, SocketReactor& rReactor):
_socket(rSocket),
_pReactor(&rReactor)
/// Creates a SocketAcceptor, using the given ServerSocket.
/// The SocketAcceptor registers itself with the given SocketReactor.
{
@ -103,18 +103,18 @@ public:
}
}
void setReactor(SocketReactor& reactor)
void setReactor(SocketReactor& rReactor)
/// Sets the reactor for this acceptor.
{
_pReactor = &reactor;
_pReactor = &rReactor;
if (!_pReactor->hasEventHandler(_socket, Poco::Observer<SocketAcceptor,
ReadableNotification>(*this, &SocketAcceptor::onAccept)))
{
registerAcceptor(reactor);
registerAcceptor(rReactor);
}
}
virtual void registerAcceptor(SocketReactor& reactor)
virtual void registerAcceptor(SocketReactor& rReactor)
/// Registers the SocketAcceptor with a SocketReactor.
///
/// A subclass can override this function to e.g.
@ -128,7 +128,7 @@ public:
if (_pReactor)
throw Poco::InvalidAccessException("Acceptor already registered.");
_pReactor = &reactor;
_pReactor = &rReactor;
_pReactor->addEventHandler(_socket, Poco::Observer<SocketAcceptor, ReadableNotification>(*this, &SocketAcceptor::onAccept));
}
@ -158,12 +158,12 @@ public:
}
protected:
virtual ServiceHandler* createServiceHandler(StreamSocket& socket)
virtual ServiceHandler* createServiceHandler(StreamSocket& rSocket)
/// Create and initialize a new ServiceHandler instance.
///
/// Subclasses can override this method.
{
return new ServiceHandler(socket, *_pReactor);
return new ServiceHandler(rSocket, *_pReactor);
}
SocketReactor* reactor()

View File

@ -80,13 +80,13 @@ public:
_socket.connectNB(address);
}
SocketConnector(SocketAddress& address, SocketReactor& reactor):
SocketConnector(SocketAddress& address, SocketReactor& rReactor):
_pReactor(0)
/// Creates an acceptor, using the given ServerSocket.
/// The SocketConnector registers itself with the given SocketReactor.
{
_socket.connectNB(address);
registerConnector(reactor);
registerConnector(rReactor);
}
virtual ~SocketConnector()
@ -102,7 +102,7 @@ public:
}
}
virtual void registerConnector(SocketReactor& reactor)
virtual void registerConnector(SocketReactor& rReactor)
/// Registers the SocketConnector with a SocketReactor.
///
/// A subclass can override this and, for example, also register
@ -110,7 +110,7 @@ public:
///
/// The overriding method must call the baseclass implementation first.
{
_pReactor = &reactor;
_pReactor = &rReactor;
_pReactor->addEventHandler(_socket, Poco::Observer<SocketConnector, ReadableNotification>(*this, &SocketConnector::onReadable));
_pReactor->addEventHandler(_socket, Poco::Observer<SocketConnector, WritableNotification>(*this, &SocketConnector::onWritable));
_pReactor->addEventHandler(_socket, Poco::Observer<SocketConnector, ErrorNotification>(*this, &SocketConnector::onError));

View File

@ -27,7 +27,7 @@ using Poco::Net::ServiceNotFoundException;
using Poco::Net::NoAddressFoundException;
DNSTest::DNSTest(const std::string& name): CppUnit::TestCase(name)
DNSTest::DNSTest(const std::string& rName): CppUnit::TestCase(rName)
{
}
@ -52,7 +52,7 @@ void DNSTest::testHostByName()
try
{
HostEntry he1 = DNS::hostByName("nohost.appinf.com");
HostEntry he2 = DNS::hostByName("nohost.appinf.com");
fail("host not found - must throw");
}
catch (HostNotFoundException&)

View File

@ -36,7 +36,7 @@ using Poco::InvalidArgumentException;
using Poco::IOException;
DatagramSocketTest::DatagramSocketTest(const std::string& name): CppUnit::TestCase(name)
DatagramSocketTest::DatagramSocketTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -23,7 +23,7 @@ using Poco::Net::DialogSocket;
using Poco::Net::SocketAddress;
DialogSocketTest::DialogSocketTest(const std::string& name): CppUnit::TestCase(name)
DialogSocketTest::DialogSocketTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -63,7 +63,7 @@ namespace
};
FTPClientSessionTest::FTPClientSessionTest(const std::string& name): CppUnit::TestCase(name)
FTPClientSessionTest::FTPClientSessionTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -46,7 +46,7 @@ namespace
}
FTPStreamFactoryTest::FTPStreamFactoryTest(const std::string& name): CppUnit::TestCase(name)
FTPStreamFactoryTest::FTPStreamFactoryTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -75,7 +75,7 @@ namespace
}
HTMLFormTest::HTMLFormTest(const std::string& name): CppUnit::TestCase(name)
HTMLFormTest::HTMLFormTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -30,7 +30,7 @@ using Poco::Net::HTTPMessage;
using Poco::StreamCopier;
HTTPClientSessionTest::HTTPClientSessionTest(const std::string& name): CppUnit::TestCase(name)
HTTPClientSessionTest::HTTPClientSessionTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -35,7 +35,7 @@ using Poco::Net::NameValueCollection;
using Poco::Net::HTTPCookie;
HTTPCookieTest::HTTPCookieTest(const std::string& name): CppUnit::TestCase(name)
HTTPCookieTest::HTTPCookieTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -32,7 +32,7 @@ using Poco::Net::HTTPCredentials;
using Poco::Net::NotAuthenticatedException;
HTTPCredentialsTest::HTTPCredentialsTest(const std::string& name): CppUnit::TestCase(name)
HTTPCredentialsTest::HTTPCredentialsTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -24,7 +24,7 @@ using Poco::Net::MessageException;
using Poco::Net::NameValueCollection;
HTTPRequestTest::HTTPRequestTest(const std::string& name): CppUnit::TestCase(name)
HTTPRequestTest::HTTPRequestTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -25,7 +25,7 @@ using Poco::Net::HTTPCookie;
using Poco::Net::MessageException;
HTTPResponseTest::HTTPResponseTest(const std::string& name): CppUnit::TestCase(name)
HTTPResponseTest::HTTPResponseTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -128,7 +128,7 @@ namespace
}
HTTPServerTest::HTTPServerTest(const std::string& name): CppUnit::TestCase(name)
HTTPServerTest::HTTPServerTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -30,7 +30,7 @@ using Poco::URI;
using Poco::StreamCopier;
HTTPStreamFactoryTest::HTTPStreamFactoryTest(const std::string& name): CppUnit::TestCase(name)
HTTPStreamFactoryTest::HTTPStreamFactoryTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -34,8 +34,8 @@ using Poco::Delegate;
using Poco::AutoPtr;
ICMPClientTest::ICMPClientTest(const std::string& name):
CppUnit::TestCase(name),
ICMPClientTest::ICMPClientTest(const std::string& rName):
CppUnit::TestCase(rName),
_icmpClient(IPAddress::IPv4)
{
}

View File

@ -31,7 +31,7 @@ using Poco::TimeoutException;
using Poco::Net::ICMPException;
ICMPSocketTest::ICMPSocketTest(const std::string& name): CppUnit::TestCase(name)
ICMPSocketTest::ICMPSocketTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -21,7 +21,7 @@ using Poco::Net::IPAddress;
using Poco::Net::InvalidAddressException;
IPAddressTest::IPAddressTest(const std::string& name): CppUnit::TestCase(name)
IPAddressTest::IPAddressTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -53,14 +53,14 @@ namespace
{
_disp.push_back(header["Content-Disposition"]);
_type.push_back(header["Content-Type"]);
std::string data;
std::string dataString;
int ch = stream.get();
while (ch > 0)
{
data += (char) ch;
dataString += (char) ch;
ch = stream.get();
}
_data.push_back(data);
_data.push_back(dataString);
}
const std::vector<std::string>& data() const
@ -86,7 +86,7 @@ namespace
}
MailMessageTest::MailMessageTest(const std::string& name): CppUnit::TestCase(name)
MailMessageTest::MailMessageTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -23,7 +23,7 @@ using Poco::Net::MailOutputStream;
using Poco::StreamCopier;
MailStreamTest::MailStreamTest(const std::string& name): CppUnit::TestCase(name)
MailStreamTest::MailStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -19,7 +19,7 @@
using Poco::Net::MediaType;
MediaTypeTest::MediaTypeTest(const std::string& name): CppUnit::TestCase(name)
MediaTypeTest::MediaTypeTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -23,7 +23,7 @@ using Poco::Net::NameValueCollection;
using Poco::Net::MessageException;
MessageHeaderTest::MessageHeaderTest(const std::string& name): CppUnit::TestCase(name)
MessageHeaderTest::MessageHeaderTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -37,7 +37,7 @@ using Poco::InvalidArgumentException;
using Poco::IOException;
MulticastSocketTest::MulticastSocketTest(const std::string& name): CppUnit::TestCase(name)
MulticastSocketTest::MulticastSocketTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -24,7 +24,7 @@ using Poco::Net::MessageHeader;
using Poco::Net::MultipartException;
MultipartReaderTest::MultipartReaderTest(const std::string& name): CppUnit::TestCase(name)
MultipartReaderTest::MultipartReaderTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -22,7 +22,7 @@ using Poco::Net::MultipartWriter;
using Poco::Net::MessageHeader;
MultipartWriterTest::MultipartWriterTest(const std::string& name): CppUnit::TestCase(name)
MultipartWriterTest::MultipartWriterTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -34,8 +34,8 @@ using Poco::Delegate;
using Poco::AutoPtr;
NTPClientTest::NTPClientTest(const std::string& name):
CppUnit::TestCase(name),
NTPClientTest::NTPClientTest(const std::string& rName):
CppUnit::TestCase(rName),
_ntpClient(IPAddress::IPv4)
{
}

View File

@ -21,7 +21,7 @@ using Poco::Net::NameValueCollection;
using Poco::NotFoundException;
NameValueCollectionTest::NameValueCollectionTest(const std::string& name): CppUnit::TestCase(name)
NameValueCollectionTest::NameValueCollectionTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -29,7 +29,7 @@ using Poco::Net::IPAddress;
using Poco::NotFoundException;
NetworkInterfaceTest::NetworkInterfaceTest(const std::string& name): CppUnit::TestCase(name)
NetworkInterfaceTest::NetworkInterfaceTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -29,7 +29,7 @@ using Poco::Net::HTMLForm;
using Poco::URI;
OAuth10CredentialsTest::OAuth10CredentialsTest(const std::string& name): CppUnit::TestCase(name)
OAuth10CredentialsTest::OAuth10CredentialsTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -23,7 +23,7 @@ using Poco::Net::OAuth20Credentials;
using Poco::Net::NotAuthenticatedException;
OAuth20CredentialsTest::OAuth20CredentialsTest(const std::string& name): CppUnit::TestCase(name)
OAuth20CredentialsTest::OAuth20CredentialsTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -25,7 +25,7 @@ using Poco::Net::MailMessage;
using Poco::Net::POP3Exception;
POP3ClientSessionTest::POP3ClientSessionTest(const std::string& name): CppUnit::TestCase(name)
POP3ClientSessionTest::POP3ClientSessionTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -22,7 +22,7 @@ using Poco::Net::QuotedPrintableEncoder;
using Poco::Net::QuotedPrintableDecoder;
QuotedPrintableTest::QuotedPrintableTest(const std::string& name): CppUnit::TestCase(name)
QuotedPrintableTest::QuotedPrintableTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -33,7 +33,7 @@ using Poco::InvalidArgumentException;
using Poco::IOException;
RawSocketTest::RawSocketTest(const std::string& name): CppUnit::TestCase(name)
RawSocketTest::RawSocketTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -26,7 +26,7 @@ using Poco::Net::MailRecipient;
using Poco::Net::SMTPException;
SMTPClientSessionTest::SMTPClientSessionTest(const std::string& name): CppUnit::TestCase(name)
SMTPClientSessionTest::SMTPClientSessionTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -26,7 +26,7 @@ using Poco::Net::NoAddressFoundException;
using Poco::InvalidArgumentException;
SocketAddressTest::SocketAddressTest(const std::string& name): CppUnit::TestCase(name)
SocketAddressTest::SocketAddressTest(const std::string& rName): CppUnit::TestCase(rName)
{
}
@ -61,7 +61,7 @@ void SocketAddressTest::testSocketAddress()
try
{
SocketAddress sa3("192.168.1.100", "f00bar");
SocketAddress sa4("192.168.1.100", "f00bar");
fail("bad service name - must throw");
}
catch (ServiceNotFoundException&)

View File

@ -136,8 +136,8 @@ namespace
checkWritableObserverCount(1);
_reactor.removeEventHandler(_socket, Observer<ClientServiceHandler, WritableNotification>(*this, &ClientServiceHandler::onWritable));
checkWritableObserverCount(0);
std::string data(1024, 'x');
_socket.sendBytes(data.data(), (int) data.length());
std::string dataString(1024, 'x');
_socket.sendBytes(dataString.data(), (int) dataString.length());
_socket.shutdownSend();
}
@ -253,13 +253,13 @@ namespace
class FailConnector: public SocketConnector<ClientServiceHandler>
{
public:
FailConnector(SocketAddress& address, SocketReactor& reactor):
SocketConnector<ClientServiceHandler>(address, reactor),
FailConnector(SocketAddress& address, SocketReactor& rReactor):
SocketConnector<ClientServiceHandler>(address, rReactor),
_failed(false),
_shutdown(false)
{
reactor.addEventHandler(socket(), Observer<FailConnector, TimeoutNotification>(*this, &FailConnector::onTimeout));
reactor.addEventHandler(socket(), Observer<FailConnector, ShutdownNotification>(*this, &FailConnector::onShutdown));
rReactor.addEventHandler(socket(), Observer<FailConnector, TimeoutNotification>(*this, &FailConnector::onTimeout));
rReactor.addEventHandler(socket(), Observer<FailConnector, ShutdownNotification>(*this, &FailConnector::onShutdown));
}
void onShutdown(ShutdownNotification* pNf)
@ -298,7 +298,7 @@ namespace
}
SocketReactorTest::SocketReactorTest(const std::string& name): CppUnit::TestCase(name)
SocketReactorTest::SocketReactorTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -35,7 +35,7 @@ using Poco::TimeoutException;
using Poco::InvalidArgumentException;
SocketStreamTest::SocketStreamTest(const std::string& name): CppUnit::TestCase(name)
SocketStreamTest::SocketStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -41,7 +41,7 @@ using Poco::FIFOBuffer;
using Poco::delegate;
SocketTest::SocketTest(const std::string& name): CppUnit::TestCase(name)
SocketTest::SocketTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -112,7 +112,7 @@ void CachingChannel::getMessages(std::vector<Poco::Message>& msg, int offset, in
}
SyslogTest::SyslogTest(const std::string& name): CppUnit::TestCase(name)
SyslogTest::SyslogTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -65,7 +65,7 @@ namespace
}
TCPServerTest::TCPServerTest(const std::string& name): CppUnit::TestCase(name)
TCPServerTest::TCPServerTest(const std::string& rName): CppUnit::TestCase(rName)
{
}

View File

@ -101,7 +101,7 @@ namespace
}
WebSocketTest::WebSocketTest(const std::string& name): CppUnit::TestCase(name)
WebSocketTest::WebSocketTest(const std::string& rName): CppUnit::TestCase(rName)
{
}