From 122a84b203e99654813c3bf5d49ff55c2b6706b0 Mon Sep 17 00:00:00 2001 From: Carl Walsh Date: Wed, 26 Mar 2025 17:05:56 -0700 Subject: [PATCH] Fix implicit conversions When upgrading xcode&cmake, our build added the option `-Wshorten-64-to-32` causing: > warning: implicit conversion loses integer precision: 'size_type' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] Just use the exact type of assignment. Passes our internal scenarios, and `make test` on macOS. --- easywsclient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easywsclient.cpp b/easywsclient.cpp index 0c98098..17c590d 100644 --- a/easywsclient.cpp +++ b/easywsclient.cpp @@ -206,7 +206,7 @@ class _RealWebSocket : public easywsclient::WebSocket } while (true) { // FD_ISSET(0, &rfds) will be true - int N = rxbuf.size(); + size_t N = rxbuf.size(); ssize_t ret; rxbuf.resize(N + 1500); ret = recv(sockfd, (char*)&rxbuf[0] + N, 1500, 0); @@ -227,7 +227,7 @@ class _RealWebSocket : public easywsclient::WebSocket } } while (txbuf.size()) { - int ret = ::send(sockfd, (char*)&txbuf[0], txbuf.size(), 0); + ssize_t ret = ::send(sockfd, (char*)&txbuf[0], txbuf.size(), 0); if (false) { } // ?? else if (ret < 0 && (socketerrno == SOCKET_EWOULDBLOCK || socketerrno == SOCKET_EAGAIN_EINPROGRESS)) { break;