Skip to content

Commit

Permalink
added explicit casting to avoid warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbert Schmitz committed May 10, 2023
1 parent 7128c25 commit 17d976d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/dpp/stringops.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ template <uint64_t> uint64_t from_string(const std::string &s)
*/
template <uint32_t> uint32_t from_string(const std::string &s)
{
return std::stoul(s, 0, 10);
return (uint32_t) std::stoul(s, 0, 10);
}

/**
Expand Down Expand Up @@ -205,7 +205,7 @@ template <typename T> std::string to_hex(T i)
template <typename T> 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();
}

Expand Down
4 changes: 2 additions & 2 deletions src/dpp/discordvoiceclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/dpp/sslclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 17d976d

Please sign in to comment.