diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-23 13:51:35 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-23 18:05:24 +0300 |
commit | ba5174d48808a07c442af67274c2364998caeb2b (patch) | |
tree | a32f4bf73d671a8a78cacd4808227b3f107654d2 /src | |
parent | 70a4aff15b995f0e7c99a9935bef0a24362614eb (diff) | |
download | libmicrohttpd-ba5174d48808a07c442af67274c2364998caeb2b.tar.gz libmicrohttpd-ba5174d48808a07c442af67274c2364998caeb2b.zip |
Fixed build with MSVC, fixed compiler warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/microhttpd/internal.h | 3 | ||||
-rw-r--r-- | src/microhttpd/mhd_send.c | 2 | ||||
-rw-r--r-- | 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 | |||
357 | char *iov_base; | 357 | char *iov_base; |
358 | } MHD_iovec_; | 358 | } MHD_iovec_; |
359 | #define MHD_IOV_ELMN_MAX_SIZE ULONG_MAX | 359 | #define MHD_IOV_ELMN_MAX_SIZE ULONG_MAX |
360 | typedef unsigned long MHD_iov_size_; | ||
360 | #elif defined(HAVE_SENDMSG) || defined(HAVE_WRITEV) | 361 | #elif defined(HAVE_SENDMSG) || defined(HAVE_WRITEV) |
361 | /** | 362 | /** |
362 | * Internally used I/O vector type for use when writev or sendmsg | 363 | * Internally used I/O vector type for use when writev or sendmsg |
@@ -364,6 +365,7 @@ typedef struct _MHD_W32_iovec | |||
364 | */ | 365 | */ |
365 | typedef struct iovec MHD_iovec_; | 366 | typedef struct iovec MHD_iovec_; |
366 | #define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX | 367 | #define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX |
368 | typedef size_t MHD_iov_size_; | ||
367 | #else | 369 | #else |
368 | /** | 370 | /** |
369 | * Internally used I/O vector type for use when writev or sendmsg | 371 | * Internally used I/O vector type for use when writev or sendmsg |
@@ -371,6 +373,7 @@ typedef struct iovec MHD_iovec_; | |||
371 | */ | 373 | */ |
372 | typedef struct MHD_IoVec MHD_iovec_; | 374 | typedef struct MHD_IoVec MHD_iovec_; |
373 | #define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX | 375 | #define MHD_IOV_ELMN_MAX_SIZE SIZE_MAX |
376 | typedef size_t MHD_iov_size_; | ||
374 | #endif | 377 | #endif |
375 | 378 | ||
376 | 379 | ||
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, | |||
1511 | /* The last iov element has been partially sent */ | 1511 | /* The last iov element has been partially sent */ |
1512 | r_iov->iov[r_iov->sent].iov_base = | 1512 | r_iov->iov[r_iov->sent].iov_base = |
1513 | (void*) ((uint8_t*) r_iov->iov[r_iov->sent].iov_base + (size_t) res); | 1513 | (void*) ((uint8_t*) r_iov->iov[r_iov->sent].iov_base + (size_t) res); |
1514 | r_iov->iov[r_iov->sent].iov_len -= res; | 1514 | r_iov->iov[r_iov->sent].iov_len -= (MHD_iov_size_) res; |
1515 | } | 1515 | } |
1516 | } | 1516 | } |
1517 | 1517 | ||
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, | |||
961 | for (i = 0; i < iovcnt; ++i) | 961 | for (i = 0; i < iovcnt; ++i) |
962 | { | 962 | { |
963 | size_t element_size = iov[i].iov_len; | 963 | size_t element_size = iov[i].iov_len; |
964 | const void *buf = iov[i].iov_base; | 964 | const uint8_t *buf = (const uint8_t *) iov[i].iov_base; |
965 | 965 | ||
966 | if (0 == element_size) | 966 | if (0 == element_size) |
967 | continue; /* skip zero-sized elements */ | 967 | continue; /* skip zero-sized elements */ |
968 | #if defined(MHD_WINSOCK_SOCKETS) && defined(_WIN64) | 968 | #if defined(MHD_WINSOCK_SOCKETS) && defined(_WIN64) |
969 | while (ULONG_MAX < element_size) | 969 | while (MHD_IOV_ELMN_MAX_SIZE < element_size) |
970 | { | 970 | { |
971 | iov_copy[i_cp].iov_base = (char *) buf; | 971 | iov_copy[i_cp].iov_base = (char *) buf; |
972 | iov_copy[i_cp].iov_len = ULONG_MAX; | 972 | iov_copy[i_cp].iov_len = ULONG_MAX; |
@@ -976,7 +976,7 @@ MHD_create_response_from_iovec (const struct MHD_IoVec *iov, | |||
976 | } | 976 | } |
977 | #endif /* MHD_WINSOCK_SOCKETS && _WIN64 */ | 977 | #endif /* MHD_WINSOCK_SOCKETS && _WIN64 */ |
978 | iov_copy[i_cp].iov_base = (void *) buf; | 978 | iov_copy[i_cp].iov_base = (void *) buf; |
979 | iov_copy[i_cp].iov_len = element_size; | 979 | iov_copy[i_cp].iov_len = (MHD_iov_size_) element_size; |
980 | i_cp++; | 980 | i_cp++; |
981 | } | 981 | } |
982 | mhd_assert (num_copy_elements == i_cp); | 982 | mhd_assert (num_copy_elements == i_cp); |