On Windows, the read function from <io.h> is used, which has its byte
count parameter as unsigned int instead of size_t.
Closes https://github.com/curl/curl/pull/2972
*/
#include <stdio.h>
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <curl/curl.h>
+
#ifdef WIN32
# include <io.h>
+# define READ_3RD_ARG unsigned int
#else
# include <unistd.h>
+# define READ_3RD_ARG size_t
#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <curl/curl.h>
#if LIBCURL_VERSION_NUM < 0x070c03
#error "upgrade your libcurl to no less than 7.12.3"
int *fdp = (int *)stream;
int fd = *fdp;
- retcode = read(fd, ptr, size * nmemb);
+ retcode = read(fd, ptr, (READ_3RD_ARG)(size * nmemb));
nread = (curl_off_t)retcode;