]> git.tdb.fi Git - libs/net.git/blobdiff - source/streamlistensocket.cpp
Style update: spaces around assignments
[libs/net.git] / source / streamlistensocket.cpp
index 2a8bc3d216e89c85a4a69e1dd17017601c7e4ee7..68580d7627672e7041e79f1a415d5c63d8c156eb 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspnet
-Copyright © 2008  Mikkosoft Productions, Mikko Rasa
-Distributed under the LGPL
-*/
-
 #include <cerrno>
 #include <msp/core/refptr.h>
 #include <msp/strings/formatter.h>
@@ -28,7 +21,7 @@ void StreamListenSocket::listen(const SockAddr &addr, unsigned backlog)
 {
        bind(addr);
 
-       int err=::listen(handle, backlog);
+       int err = ::listen(handle, backlog);
        if(err==-1)
                throw SystemError("Unable to listen", errno);
 
@@ -37,7 +30,7 @@ void StreamListenSocket::listen(const SockAddr &addr, unsigned backlog)
 #endif
        set_events(IO::P_INPUT);
 
-       listening=true;
+       listening = true;
 }
 
 StreamSocket *StreamListenSocket::accept()
@@ -45,11 +38,11 @@ StreamSocket *StreamListenSocket::accept()
        if(!listening)
                throw InvalidState("Socket is not listening");
 
-       sockaddr sa;
-       socklen_t size=sizeof(sockaddr);
-       SocketHandle new_h=::accept(handle, &sa, &size);
+       sockaddr_storage sa;
+       socklen_t size = sizeof(sockaddr_storage);
+       SocketHandle new_h = ::accept(handle, reinterpret_cast<sockaddr *>(&sa), &size);
 
-       RefPtr<SockAddr> paddr=SockAddr::create(sa);
+       RefPtr<SockAddr> paddr = SockAddr::create(sa);
        return new StreamSocket(new_h, *paddr);
 }