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
base: master
from

Conversation

Projects
None yet
2 participants
@MarcelRaad
Member

MarcelRaad 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.

@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.

@MarcelRaad

MarcelRaad Sep 11, 2018

Member

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

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 deleted the MarcelRaad:anyauthput_warning branch Sep 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment