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

anyauthput: fix compiler warning on 64-bit Windows #2972

Closed
wants to merge 1 commit into from

Conversation

@MarcelRaad
Copy link
Member

commented Sep 10, 2018

On Windows, the read function from <io.h> is used, which has its byte
count parameter as unsigned int instead of size_t [0].

The warning is visible in the autobuilds: https://curl.haxx.se/dev/log.cgi?id=20180910161513-27869#prob1

[0] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/read

retcode = read(fd, ptr, size * nmemb);
#endif

This comment has been minimized.

Copy link
@bagder

bagder Sep 11, 2018

Member

how about instead writing it in a way that only has the function call in one place?

#ifdef WIN32
#define READ_3RD_ARG unsigned int
#else 
#define READ_3RD_ARG size_t
#endif

  retcode = read(fd, ptr, (READ_3RD_ARG)(size * nmemb));

This comment has been minimized.

Copy link
@MarcelRaad

MarcelRaad Sep 11, 2018

Author Member

Looks better, yes, and then it can also be integrated into the existing #ifdef. Thanks!

@MarcelRaad MarcelRaad force-pushed the MarcelRaad:anyauthput_warning branch from 4744b54 to ae5e989 Sep 11, 2018

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Sep 11, 2018
anyauthput: fix compiler warning on 64-bit Windows
On Windows, the read function from <io.h> is used, which has its byte
count parameter as unsigned int instead of size_t.

Closes curl#2972
anyauthput: fix compiler warning on 64-bit Windows
On Windows, the read function from <io.h> is used, which has its byte
count parameter as unsigned int instead of size_t.

Closes #2972

@MarcelRaad MarcelRaad force-pushed the MarcelRaad:anyauthput_warning branch from ae5e989 to 2a6d671 Sep 11, 2018

@MarcelRaad MarcelRaad deleted the MarcelRaad:anyauthput_warning branch Sep 12, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Dec 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.