From 708969c12641c195b5e8098a661d2de368874caa Mon Sep 17 00:00:00 2001 From: fcojavmc Date: Wed, 20 Nov 2019 20:12:24 +0100 Subject: [PATCH] Compile bug (#122) * 1) IXWebSocketTransport: BUG: int type has no warranty of number of bits. It depends on compiler and architecture. In my system (64 bit) is 32 bit. 1 << 63 is bad idea in this case because the final number is 0 by overflow. The symptom observed is that the server can't receive messages. 2) IXSocketFactory: Compilation Warning: Variable not in use. * Better aproach suggested by Benjamin. --- ixwebsocket/IXSocketFactory.cpp | 1 + ixwebsocket/IXWebSocketTransport.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ixwebsocket/IXSocketFactory.cpp b/ixwebsocket/IXSocketFactory.cpp index cc148aaf..7c680512 100644 --- a/ixwebsocket/IXSocketFactory.cpp +++ b/ixwebsocket/IXSocketFactory.cpp @@ -31,6 +31,7 @@ namespace ix std::string& errorMsg, const SocketTLSOptions& tlsOptions) { + (void) tlsOptions; errorMsg.clear(); std::shared_ptr socket; diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index 691671f4..48bcfc6b 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -543,7 +543,7 @@ namespace ix } // Prevent integer overflow in the next conditional - const uint64_t maxFrameSize(1 << 63); + const uint64_t maxFrameSize(1ULL << 63); if (ws.N > maxFrameSize) { return;