From 83fe7b778a7fddf7454acf1f3b9afbd856ff9009 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Sat, 14 May 2022 16:09:10 +0300 Subject: Fixed additional compiler warnings on W32 --- src/microhttpd/daemon.c | 2 +- src/microhttpd/mhd_send.c | 6 +++--- src/microhttpd/mhd_threads.c | 2 +- src/microhttpd/response.c | 16 ++++++++++------ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index beeee7d8..e96ef4a2 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c @@ -7011,7 +7011,7 @@ MHD_start_daemon_va (unsigned int flags, #else /* SO_EXCLBIND */ SO_EXCLBIND, #endif /* SO_EXCLBIND */ - (void *) &on, + (const void *) &on, sizeof (on))) { #ifdef HAVE_MESSAGES diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index c607a4c8..be471619 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c @@ -1081,9 +1081,9 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection, complete_response = false; push_body = complete_response; } - vector[0].buf = (char *) header; + vector[0].buf = (char *) _MHD_DROP_CONST (header); vector[0].len = (unsigned long) header_size; - vector[1].buf = (char *) body; + vector[1].buf = (char *) _MHD_DROP_CONST (body); vector[1].len = (unsigned long) body_size; ret = WSASend (s, vector, 2, &vec_sent, 0, NULL, NULL); @@ -1600,7 +1600,7 @@ send_iov_emu (struct MHD_Connection *connection, * Adjust buffer of the last element. */ r_iov->iov[r_iov->sent].iov_base = (void *) ((uint8_t *) r_iov->iov[r_iov->sent].iov_base + sent); - r_iov->iov[r_iov->sent].iov_len -= sent; + r_iov->iov[r_iov->sent].iov_len -= (MHD_iov_size_) sent; return (ssize_t) total_sent; } diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c index 45a10f12..628a628f 100644 --- a/src/microhttpd/mhd_threads.c +++ b/src/microhttpd/mhd_threads.c @@ -225,7 +225,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread, } #endif /* SIZEOF_SIZE_T != SIZEOF_UNSIGNED_INT */ - thread->handle = (MHD_thread_handle_) + thread->handle = (MHD_thread_handle_) (uintptr_t) _beginthreadex (NULL, (unsigned int) stack_size, start_routine, diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 463f01a7..4c6c192a 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c @@ -967,7 +967,7 @@ file_reader (void *cls, #if ! defined(_WIN32) || defined(__CYGWIN__) ssize_t n; #else /* _WIN32 && !__CYGWIN__ */ - const HANDLE fh = (HANDLE) _get_osfhandle (response->fd); + const HANDLE fh = (HANDLE) (uintptr_t) _get_osfhandle (response->fd); #endif /* _WIN32 && !__CYGWIN__ */ const int64_t offset64 = (int64_t) (pos + response->fd_off); @@ -1055,17 +1055,21 @@ pipe_reader (void *cls, ssize_t n; (void) pos; + #ifndef _WIN32 if (SSIZE_MAX < max) max = SSIZE_MAX; + n = read (response->fd, + buf, + (MHD_SCKT_SEND_SIZE_) max); #else /* _WIN32 */ if (UINT_MAX < max) - max = UINT_MAX; -#endif /* _WIN32 */ - + max = INT_MAX; n = read (response->fd, buf, - (MHD_SCKT_SEND_SIZE_) max); + (unsigned int) max); +#endif /* _WIN32 */ + if (0 == n) return MHD_CONTENT_READER_END_OF_STREAM; if (n < 0) @@ -1595,7 +1599,7 @@ MHD_create_response_from_iovec (const struct MHD_IoVec *iov, { int64_t i_add; - i_add = iov[i].iov_len / ULONG_MAX; + i_add = (int64_t) (iov[i].iov_len / ULONG_MAX); if (0 != iov[i].iov_len % ULONG_MAX) i_add++; if (INT_MAX < (i_add + i_cp)) -- cgit v1.2.3