gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 02/05: Fixed build with MSVC, fixed compiler warnings


From: gnunet
Subject: [libmicrohttpd] 02/05: Fixed build with MSVC, fixed compiler warnings
Date: Fri, 23 Apr 2021 17:08:47 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit ba5174d48808a07c442af67274c2364998caeb2b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Apr 23 13:51:35 2021 +0300

    Fixed build with MSVC, fixed compiler warnings
---
 src/microhttpd/internal.h | 3 +++
 src/microhttpd/mhd_send.c | 2 +-
 src/microhttpd/response.c | 6 +++---
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index f660dff1..346001c3 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -357,6 +357,7 @@ typedef struct _MHD_W32_iovec
   char *iov_base;
 } MHD_iovec_;
 #define MHD_IOV_ELMN_MAX_SIZE    ULONG_MAX
+typedef unsigned long MHD_iov_size_;
 #elif defined(HAVE_SENDMSG) || defined(HAVE_WRITEV)
 /**
  * Internally used I/O vector type for use when writev or sendmsg
@@ -364,6 +365,7 @@ typedef struct _MHD_W32_iovec
  */
 typedef struct iovec MHD_iovec_;
 #define MHD_IOV_ELMN_MAX_SIZE    SIZE_MAX
+typedef size_t MHD_iov_size_;
 #else
 /**
  * Internally used I/O vector type for use when writev or sendmsg
@@ -371,6 +373,7 @@ typedef struct iovec MHD_iovec_;
  */
 typedef struct MHD_IoVec MHD_iovec_;
 #define MHD_IOV_ELMN_MAX_SIZE    SIZE_MAX
+typedef size_t MHD_iov_size_;
 #endif
 
 
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index a69fbd07..ffba5b95 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -1511,7 +1511,7 @@ send_iov_nontls (struct MHD_Connection *connection,
       /* The last iov element has been partially sent */
       r_iov->iov[r_iov->sent].iov_base =
         (void*) ((uint8_t*) r_iov->iov[r_iov->sent].iov_base + (size_t) res);
-      r_iov->iov[r_iov->sent].iov_len -= res;
+      r_iov->iov[r_iov->sent].iov_len -= (MHD_iov_size_) res;
     }
   }
 
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 8c047077..3ff10fe0 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -961,12 +961,12 @@ MHD_create_response_from_iovec (const struct MHD_IoVec 
*iov,
     for (i = 0; i < iovcnt; ++i)
     {
       size_t element_size = iov[i].iov_len;
-      const void *buf = iov[i].iov_base;
+      const uint8_t *buf = (const uint8_t *) iov[i].iov_base;
 
       if (0 == element_size)
         continue;         /* skip zero-sized elements */
 #if defined(MHD_WINSOCK_SOCKETS) && defined(_WIN64)
-      while (ULONG_MAX < element_size)
+      while (MHD_IOV_ELMN_MAX_SIZE < element_size)
       {
         iov_copy[i_cp].iov_base = (char *) buf;
         iov_copy[i_cp].iov_len = ULONG_MAX;
@@ -976,7 +976,7 @@ MHD_create_response_from_iovec (const struct MHD_IoVec *iov,
       }
 #endif /* MHD_WINSOCK_SOCKETS && _WIN64 */
       iov_copy[i_cp].iov_base = (void *) buf;
-      iov_copy[i_cp].iov_len = element_size;
+      iov_copy[i_cp].iov_len = (MHD_iov_size_) element_size;
       i_cp++;
     }
     mhd_assert (num_copy_elements == i_cp);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]