commit f0d4dde902692968ef34f93796d05b1417d92dae
parent 1ad74ebc4637f800ff14f901ceca27795a93cce4
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sun, 11 Oct 2020 15:59:05 +0300
Fixed compiler warnings
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
@@ -2958,6 +2958,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
{
const size_t wb_ready = connection->write_buffer_append_offset
- connection->write_buffer_send_offset;
+ mhd_assert (connection->write_buffer_append_offset > \
+ connection->write_buffer_send_offset);
/* if the response body is not available, we use MHD_send_on_connection_() */
if (NULL != connection->response->crc)
@@ -2987,7 +2989,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
"Connection was closed while sending response headers.\n"));
return;
}
- if (ret > wb_ready)
+ /* 'ret' is not negative, it's safe to cast it to 'size_t'. */
+ if (((size_t) ret) > wb_ready)
{
mhd_assert (NULL == connection->response->crc);
/* We sent not just header data but also some response data,
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -5163,8 +5163,9 @@ parse_options_va (struct MHD_Daemon *daemon,
#endif
daemon->worker_pool_size = 0;
}
+#if (0 == (UINT_MAX + 0)) || (UINT_MAX >= (SIZE_MAX / (64 * 1024)))
/* Next comparison could be always false on some platforms and whole branch will
- * be optimized out on those platforms. On others it will be compiled into real
+ * be optimized out on these platforms. On others it will be compiled into real
* check. */
else if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct
MHD_Daemon))) /* Compiler may warn on some platforms, ignore warning. */
@@ -5176,6 +5177,7 @@ parse_options_va (struct MHD_Daemon *daemon,
#endif
return MHD_NO;
}
+#endif /* (UINT_MAX >= (SIZE_MAX/(64*1024))) */
else
{
if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))