summaryrefslogtreecommitdiff
path: root/lib/server/Socket.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2008-08-21 11:04:21 +0000
committerChris Wilson <chris+github@qwirx.com>2008-08-21 11:04:21 +0000
commit96c337af8c1b79911fe0268db9337970f794094c (patch)
tree5a73a02c5ed3b076e2866cdcb708079df0d10074 /lib/server/Socket.cpp
parentd68ebb825e12bf7e3a99be456f0e02e5e374b7e3 (diff)
Make Open() take a const std::string& for the socket name instead of a
const char *, for C++ style.
Diffstat (limited to 'lib/server/Socket.cpp')
-rw-r--r--lib/server/Socket.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/server/Socket.cpp b/lib/server/Socket.cpp
index 28dae69f..a450cd93 100644
--- a/lib/server/Socket.cpp
+++ b/lib/server/Socket.cpp
@@ -37,7 +37,8 @@
// Created: 2003/07/31
//
// --------------------------------------------------------------------------
-void Socket::NameLookupToSockAddr(SocketAllAddr &addr, int &sockDomain, int Type, const char *Name, int Port, int &rSockAddrLenOut)
+void Socket::NameLookupToSockAddr(SocketAllAddr &addr, int &sockDomain,
+ int Type, const std::string& rName, int Port, int &rSockAddrLenOut)
{
int sockAddrLen = 0;
@@ -47,7 +48,7 @@ void Socket::NameLookupToSockAddr(SocketAllAddr &addr, int &sockDomain, int Type
sockDomain = AF_INET;
{
// Lookup hostname
- struct hostent *phost = ::gethostbyname(Name);
+ struct hostent *phost = ::gethostbyname(rName.c_str());
if(phost != NULL)
{
if(phost->h_addr_list[0] != 0)
@@ -81,7 +82,7 @@ void Socket::NameLookupToSockAddr(SocketAllAddr &addr, int &sockDomain, int Type
sockDomain = AF_UNIX;
{
// Check length of name is OK
- unsigned int nameLen = ::strlen(Name);
+ unsigned int nameLen = rName.length();
if(nameLen >= (sizeof(addr.sa_unix.sun_path) - 1))
{
THROW_EXCEPTION(ServerException, SocketNameUNIXPathTooLong);
@@ -91,7 +92,7 @@ void Socket::NameLookupToSockAddr(SocketAllAddr &addr, int &sockDomain, int Type
addr.sa_unix.sun_len = sockAddrLen;
#endif
addr.sa_unix.sun_family = PF_UNIX;
- ::strcpy(addr.sa_unix.sun_path, Name);
+ ::strcpy(addr.sa_unix.sun_path, rName.c_str());
}
break;
#endif