From 17d976d6d27fe7fce9280f233e31277a557f646a Mon Sep 17 00:00:00 2001 From: Norbert Schmitz Date: Wed, 10 May 2023 13:07:15 +0200 Subject: [PATCH] added explicit casting to avoid warnings --- include/dpp/stringops.h | 4 ++-- src/dpp/discordvoiceclient.cpp | 4 ++-- src/dpp/sslclient.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/dpp/stringops.h b/include/dpp/stringops.h index 856ff30103..bdab70bdef 100644 --- a/include/dpp/stringops.h +++ b/include/dpp/stringops.h @@ -165,7 +165,7 @@ template uint64_t from_string(const std::string &s) */ template uint32_t from_string(const std::string &s) { - return std::stoul(s, 0, 10); + return (uint32_t) std::stoul(s, 0, 10); } /** @@ -205,7 +205,7 @@ template std::string to_hex(T i) template std::string leading_zeroes(T i, size_t width) { std::stringstream stream; - stream << std::setfill('0') << std::setw(width) << std::dec << i; + stream << std::setfill('0') << std::setw((int)width) << std::dec << i; return stream.str(); } diff --git a/src/dpp/discordvoiceclient.cpp b/src/dpp/discordvoiceclient.cpp index 7e1308b264..7d9ff7ccc5 100644 --- a/src/dpp/discordvoiceclient.cpp +++ b/src/dpp/discordvoiceclient.cpp @@ -398,12 +398,12 @@ int discord_voice_client::udp_send(const char* data, size_t length) servaddr.sin_family = AF_INET; servaddr.sin_port = htons(this->port); servaddr.sin_addr.s_addr = inet_addr(this->ip.c_str()); - return sendto(this->fd, data, (int)length, 0, (const sockaddr*)&servaddr, (int)sizeof(sockaddr_in)); + return (int) sendto(this->fd, data, (int)length, 0, (const sockaddr*)&servaddr, (int)sizeof(sockaddr_in)); } int discord_voice_client::udp_recv(char* data, size_t max_length) { - return recv(this->fd, data, (int)max_length, 0); + return (int) recv(this->fd, data, (int)max_length, 0); } bool discord_voice_client::handle_frame(const std::string &data) diff --git a/src/dpp/sslclient.cpp b/src/dpp/sslclient.cpp index 54069681ac..95789f0720 100644 --- a/src/dpp/sslclient.cpp +++ b/src/dpp/sslclient.cpp @@ -480,7 +480,7 @@ void ssl_client::read_loop() if (plaintext) { read_blocked_on_write = false; read_blocked = false; - r = ::recv(sfd, server_to_client_buffer, DPP_BUFSIZE, 0); + r = (int) ::recv(sfd, server_to_client_buffer, DPP_BUFSIZE, 0); if (r <= 0) { /* error or EOF */ return; @@ -551,7 +551,7 @@ void ssl_client::read_loop() /* Try to write */ if (plaintext) { - r = ::send(sfd, client_to_server_buffer + client_to_server_offset, (int)client_to_server_length, 0); + r = (int) ::send(sfd, client_to_server_buffer + client_to_server_offset, (int)client_to_server_length, 0); if (r < 0) { /* Write error */