[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd2] 06/21: Fixed compiler warnings
From: |
Admin |
Subject: |
[libmicrohttpd2] 06/21: Fixed compiler warnings |
Date: |
Fri, 13 Jun 2025 23:38:14 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd2.
commit d9c6ed21f422e87205b34ba7965140c385fffc46
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
AuthorDate: Thu Jun 12 12:45:06 2025 +0200
Fixed compiler warnings
---
src/mhd2/daemon_start.c | 5 ++++-
src/mhd2/events_process.c | 13 +++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/mhd2/daemon_start.c b/src/mhd2/daemon_start.c
index 180ce0e..cef5733 100644
--- a/src/mhd2/daemon_start.c
+++ b/src/mhd2/daemon_start.c
@@ -1980,7 +1980,10 @@ allocate_events (struct MHD_Daemon *restrict d)
if ((num_elements > d->conns.cfg.count_limit) /* Check for value overflow
*/
|| (mhd_D_HAS_THR_PER_CONN (d)))
{
- const unsigned int upper_limit = (sizeof(void*) >= 8) ? 4096 : 1024;
+ const unsigned int upper_limit = (sizeof(void*) >= 8) ? 4096u : 1024u;
+
+ mhd_assert (0 < (int) upper_limit);
+ mhd_assert (upper_limit == (unsigned int) (size_t) upper_limit);
/* Trade neglectable performance penalty for memory saving */
/* Very large amount of new events processed in batches */
diff --git a/src/mhd2/events_process.c b/src/mhd2/events_process.c
index 1f67a00..9411a27 100644
--- a/src/mhd2/events_process.c
+++ b/src/mhd2/events_process.c
@@ -1593,7 +1593,7 @@ get_all_net_updates_by_epoll (struct MHD_Daemon *restrict
d)
// TODO: add listen socket enable/disable
/* Minimise amount of data passed from userspace to kernel and back */
- max_events = d->conns.cfg.count_limit;
+ max_events = (int) d->conns.cfg.count_limit;
#ifdef MHD_SUPPORT_THREADS
++max_events;
#endif /* MHD_SUPPORT_THREADS */
@@ -1602,9 +1602,8 @@ get_all_net_updates_by_epoll (struct MHD_Daemon *restrict
d)
/* Make sure that one extra slot used to clearly detect that all events
* were gotten. */
++max_events;
- if (0 > max_events)
- max_events = (int) (((unsigned int)~((unsigned int) 0)) >> 1);
- if (max_events > (int) d->events.data.epoll.num_elements)
+ if ((0 > max_events) ||
+ (max_events > (int) d->events.data.epoll.num_elements))
max_events = (int) d->events.data.epoll.num_elements;
events_processed = 0;
@@ -1648,12 +1647,14 @@ get_all_net_updates_by_epoll (struct MHD_Daemon
*restrict d)
return true; /* All events have been read */
/* Use all buffer for the next getting events round(s) */
- max_events = d->events.data.epoll.num_elements;
+ max_events = (int) d->events.data.epoll.num_elements;
+ mhd_assert (0 < max_events);
+ mhd_assert (d->events.data.epoll.num_elements == (size_t) max_events);
max_wait = 0; /* Do not block on the next getting events rounds */
events_processed += (unsigned int) num_events; /* Avoid reading too many
events */
} while ((events_processed < d->conns.cfg.count_limit)
- || (events_processed < d->conns.cfg.count_limit + 2));
+ || (events_processed < d->conns.cfg.count_limit + 2));
return true;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd2] 02/21: bootstrap: make sure that pre-commit hook really used, (continued)
- [libmicrohttpd2] 02/21: bootstrap: make sure that pre-commit hook really used, Admin, 2025/06/13
- [libmicrohttpd2] 01/21: conn_data_send.c: fixed large sending, added some asserts, Admin, 2025/06/13
- [libmicrohttpd2] 04/21: xdigittovalue(): optimised., Admin, 2025/06/13
- [libmicrohttpd2] 18/21: Renamed test_postprocessor -> test_postparser to match API naming, Admin, 2025/06/13
- [libmicrohttpd2] 16/21: configure: minor check improvement, Admin, 2025/06/13
- [libmicrohttpd2] 12/21: mhd_locks: added W32 implementation based on SRW locks (and minor improvements), Admin, 2025/06/13
- [libmicrohttpd2] 10/21: configure: added release build linker flags, Admin, 2025/06/13
- [libmicrohttpd2] 15/21: POST parser: improved parsing performance by storing complete delimiter instead of boundary, Admin, 2025/06/13
- [libmicrohttpd2] 14/21: POST parser: optimised large upload processing, Admin, 2025/06/13
- [libmicrohttpd2] 07/21: daemon_start: cosmetics, fixed code style, Admin, 2025/06/13
- [libmicrohttpd2] 06/21: Fixed compiler warnings,
Admin <=
- [libmicrohttpd2] 08/21: mhd_str: added functions attributes, fixed doxy, removed extra checks in functions, Admin, 2025/06/13
- [libmicrohttpd2] 03/21: bootstrap: English fixes, Admin, 2025/06/13
- [libmicrohttpd2] 05/21: mhd_str.c: minor readability improvements, Admin, 2025/06/13
- [libmicrohttpd2] 20/21: perf_replies: fixed formatting, Admin, 2025/06/13
- [libmicrohttpd2] 19/21: conn_data_send.c: fixed formatting, Admin, 2025/06/13
- [libmicrohttpd2] 17/21: POST parser: accelerate by using memmem() for delimiters, Admin, 2025/06/13