diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-10-11 15:59:05 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-10-11 17:17:08 +0300 |
commit | f0d4dde902692968ef34f93796d05b1417d92dae (patch) | |
tree | 648751e86c73eae8e09083b72e63fcf654f9e182 | |
parent | 1ad74ebc4637f800ff14f901ceca27795a93cce4 (diff) | |
download | libmicrohttpd-f0d4dde902692968ef34f93796d05b1417d92dae.tar.gz libmicrohttpd-f0d4dde902692968ef34f93796d05b1417d92dae.zip |
Fixed compiler warnings
-rw-r--r-- | src/microhttpd/connection.c | 5 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 7fd52739..eda98f71 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2958,6 +2958,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
2958 | { | 2958 | { |
2959 | const size_t wb_ready = connection->write_buffer_append_offset | 2959 | const size_t wb_ready = connection->write_buffer_append_offset |
2960 | - connection->write_buffer_send_offset; | 2960 | - connection->write_buffer_send_offset; |
2961 | mhd_assert (connection->write_buffer_append_offset > \ | ||
2962 | connection->write_buffer_send_offset); | ||
2961 | 2963 | ||
2962 | /* if the response body is not available, we use MHD_send_on_connection_() */ | 2964 | /* if the response body is not available, we use MHD_send_on_connection_() */ |
2963 | if (NULL != connection->response->crc) | 2965 | if (NULL != connection->response->crc) |
@@ -2987,7 +2989,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
2987 | "Connection was closed while sending response headers.\n")); | 2989 | "Connection was closed while sending response headers.\n")); |
2988 | return; | 2990 | return; |
2989 | } | 2991 | } |
2990 | if (ret > wb_ready) | 2992 | /* 'ret' is not negative, it's safe to cast it to 'size_t'. */ |
2993 | if (((size_t) ret) > wb_ready) | ||
2991 | { | 2994 | { |
2992 | mhd_assert (NULL == connection->response->crc); | 2995 | mhd_assert (NULL == connection->response->crc); |
2993 | /* We sent not just header data but also some response data, | 2996 | /* We sent not just header data but also some response data, |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 480c37cd..5a7c0caa 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -5163,8 +5163,9 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
5163 | #endif | 5163 | #endif |
5164 | daemon->worker_pool_size = 0; | 5164 | daemon->worker_pool_size = 0; |
5165 | } | 5165 | } |
5166 | #if (0 == (UINT_MAX + 0)) || (UINT_MAX >= (SIZE_MAX / (64 * 1024))) | ||
5166 | /* Next comparison could be always false on some platforms and whole branch will | 5167 | /* Next comparison could be always false on some platforms and whole branch will |
5167 | * be optimized out on those platforms. On others it will be compiled into real | 5168 | * be optimized out on these platforms. On others it will be compiled into real |
5168 | * check. */ | 5169 | * check. */ |
5169 | else if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct | 5170 | else if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct |
5170 | MHD_Daemon))) /* Compiler may warn on some platforms, ignore warning. */ | 5171 | MHD_Daemon))) /* Compiler may warn on some platforms, ignore warning. */ |
@@ -5176,6 +5177,7 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
5176 | #endif | 5177 | #endif |
5177 | return MHD_NO; | 5178 | return MHD_NO; |
5178 | } | 5179 | } |
5180 | #endif /* (UINT_MAX >= (SIZE_MAX/(64*1024))) */ | ||
5179 | else | 5181 | else |
5180 | { | 5182 | { |
5181 | if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) | 5183 | if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) |