diff options
author | David Robillard <d@drobilla.net> | 2013-01-11 04:47:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-11 04:47:21 +0000 |
commit | 10e9a3a800a35916872abf9e354be4c554338e4e (patch) | |
tree | d6be3ce7993f5d8efd525629fd321b32a6341633 /src/socket/Socket.cpp | |
parent | 684eaf6b58e41f6758b160b882a6313faf0cff18 (diff) | |
download | ingen-10e9a3a800a35916872abf9e354be4c554338e4e.tar.gz ingen-10e9a3a800a35916872abf9e354be4c554338e4e.tar.bz2 ingen-10e9a3a800a35916872abf9e354be4c554338e4e.zip |
Use type safe enumerations.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4918 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/socket/Socket.cpp')
-rw-r--r-- | src/socket/Socket.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/socket/Socket.cpp b/src/socket/Socket.cpp index 4f3592cd..2de88226 100644 --- a/src/socket/Socket.cpp +++ b/src/socket/Socket.cpp @@ -38,16 +38,16 @@ namespace Socket { Socket::Socket(Type t) : _type(t) - , _uri(t == UNIX ? "unix:" : "tcp:") + , _uri(t == Type::UNIX ? "unix:" : "tcp:") , _addr(NULL) , _addr_len(0) , _sock(-1) { switch (t) { - case UNIX: + case Type::UNIX: _sock = socket(AF_UNIX, SOCK_STREAM, 0); break; - case TCP: + case Type::TCP: _sock = socket(AF_INET, SOCK_STREAM, 0); break; } @@ -76,7 +76,7 @@ bool Socket::set_addr(const Raul::URI& uri) { free(_addr); - if (_type == UNIX && uri.substr(0, strlen("unix://")) == "unix://") { + if (_type == Type::UNIX && uri.substr(0, strlen("unix://")) == "unix://") { const std::string path = uri.substr(strlen("unix://")); struct sockaddr_un* uaddr = (struct sockaddr_un*)calloc( 1, sizeof(struct sockaddr_un)); @@ -86,7 +86,7 @@ Socket::set_addr(const Raul::URI& uri) _addr = (sockaddr*)uaddr; _addr_len = sizeof(struct sockaddr_un); return true; - } else if (_type == TCP && uri.find("://") != std::string::npos) { + } else if (_type == Type::TCP && uri.find("://") != std::string::npos) { const std::string authority = uri.substr(uri.find("://") + 3); const size_t port_sep = authority.find(':'); if (port_sep == std::string::npos) { |