From cc8a9e883e784dc577733112ee37e27adbace8bf Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Sat, 5 Jan 2019 21:10:08 -0800 Subject: [PATCH] unittest + compiler warnings --- ixwebsocket/IXSocket.cpp | 4 ++-- ixwebsocket/IXSocketConnect.cpp | 6 +++--- test/IXSocketTest.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ixwebsocket/IXSocket.cpp b/ixwebsocket/IXSocket.cpp index fda9eb4a..3154813f 100644 --- a/ixwebsocket/IXSocket.cpp +++ b/ixwebsocket/IXSocket.cpp @@ -154,7 +154,7 @@ namespace ix { if (isCancellationRequested()) return false; - int ret; + ssize_t ret; ret = recv(buffer, 1); // We read one byte, as needed, all good. @@ -197,7 +197,7 @@ namespace ix char* buffer = const_cast(str.c_str()); int len = (int) str.size(); - int ret = send(buffer, len); + ssize_t ret = send(buffer, len); // We wrote some bytes, as needed, all good. if (ret > 0) diff --git a/ixwebsocket/IXSocketConnect.cpp b/ixwebsocket/IXSocketConnect.cpp index 2eb9312d..2ccc36a7 100644 --- a/ixwebsocket/IXSocketConnect.cpp +++ b/ixwebsocket/IXSocketConnect.cpp @@ -43,9 +43,9 @@ namespace ix { errMsg = "no error"; - auto fd = socket(address->ai_family, - address->ai_socktype, - address->ai_protocol); + int fd = (int) socket(address->ai_family, + address->ai_socktype, + address->ai_protocol); if (fd < 0) { errMsg = "Cannot create a socket"; diff --git a/test/IXSocketTest.cpp b/test/IXSocketTest.cpp index 475b03d4..43f3d0af 100644 --- a/test/IXSocketTest.cpp +++ b/test/IXSocketTest.cpp @@ -42,7 +42,7 @@ namespace ix std::cout << "Sending request: " << request << "to " << host << ":" << port << std::endl; - socket->writeBytes(request, isCancellationRequested); + REQUIRE(socket->writeBytes(request, isCancellationRequested)); auto lineResult = socket->readLine(isCancellationRequested); auto lineValid = lineResult.first;