diff --git a/fetch_posix.c b/fetch_posix.c index e1d9cb2..ce6dac1 100644 --- a/fetch_posix.c +++ b/fetch_posix.c @@ -18,6 +18,7 @@ #ifdef _WIN32 # define socketerr WSAGetLastError() +# define ssize_t int #else # define socketerr errno # define SOCKET int @@ -35,7 +36,7 @@ char *fetch_get(const char *url, int32_t *error) { char *body = NULL; char *host = NULL; int32_t err = 0; - int32_t count = 0; + ssize_t count = 0; if (!url) return NULL; diff --git a/test/proxycli.c b/test/proxycli.c index 35c9658..b2cb695 100644 --- a/test/proxycli.c +++ b/test/proxycli.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -13,12 +14,13 @@ #include "proxyres/resolver.h" #ifdef _WIN32 -#include -#include -#define O_BINARY _O_BINARY +# include +# include +# define O_BINARY _O_BINARY +# define ssize_t int #else -#include -#define O_BINARY 0 +# include +# define O_BINARY 0 #endif static void print_proxy_config(int32_t option_count, char *options[]) { @@ -132,7 +134,7 @@ static bool execute_pac_script(const char *script_path, const char *url, bool ve } // Get length of PAC script - int32_t script_len = lseek(fd, 0, SEEK_END); + off_t script_len = lseek(fd, 0, SEEK_END); if (script_len < 0) { printf("Failed to get length of PAC script %s\n", script_path); goto execute_pac_cleanup; @@ -147,9 +149,10 @@ static bool execute_pac_script(const char *script_path, const char *url, bool ve // Read PAC script from file lseek(fd, 0, SEEK_SET); - int32_t bytes_read = read(fd, script, script_len); + ssize_t bytes_read = read(fd, script, script_len); if (bytes_read != script_len) { - printf("Failed to read PAC script %s (%d != %d)\n", script_path, bytes_read, script_len); + printf("Failed to read PAC script %s (%" PRId64 " != %" PRId64 ")\n", script_path, (int64_t)bytes_read, + (int64_t)script_len); goto execute_pac_cleanup; }