Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added explicit casting to avoid warnings #676

Merged
merged 1 commit into from
May 10, 2023
Merged

added explicit casting to avoid warnings #676

merged 1 commit into from
May 10, 2023

Conversation

nagilo
Copy link

@nagilo nagilo commented May 10, 2023

Using a MacOS 13.2 with Xcode 14.2 I received the following warnings.

Implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int')
Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int'

Added casts solved the warnings and is still consistent with the intention of the code.

@netlify
Copy link

netlify bot commented May 10, 2023

Deploy Preview for dpp-dev ready!

Name Link
🔨 Latest commit 17d976d
🔍 Latest deploy log https://app.netlify.com/sites/dpp-dev/deploys/645b7d9b2fabcb0007864e39
😎 Deploy Preview https://deploy-preview-676--dpp-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

}

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this?
The correct return type for recv is int already according to the standards? same with sendto

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In MacOS the return type is not int it is ssize_t which is indeed a long. Therefore it is a mapping from long to int which is causing the warning. Its not critical from my point of view but the build would be cleaner.

ssize_t recv(int, void *, size_t, int) __DARWIN_ALIAS_C(recv);

@braindigitalis braindigitalis merged commit 0ac761f into brainboxdotcc:dev May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants