libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit e1d1558570b8beb3fe32fc86a39e7d430e54f587
parent ed503f0b246a3e5b7a148032f3046b3561e3ad8c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 31 Oct 2021 17:21:51 +0300

MHD_set_connection_option(): improved readability

Fixed error reporting

Diffstat:
Msrc/microhttpd/connection.c | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -4852,6 +4852,7 @@ MHD_set_connection_option (struct MHD_Connection *connection, { va_list ap; struct MHD_Daemon *daemon; + unsigned int ui_val; daemon = connection->daemon; switch (option) @@ -4875,25 +4876,24 @@ MHD_set_connection_option (struct MHD_Connection *connection, connection); } va_start (ap, option); - connection->connection_timeout_ms = va_arg (ap, - unsigned int); + ui_val = va_arg (ap, unsigned int); va_end (ap); #if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT - if ((UINT64_MAX / 2000 - 1) < connection->connection_timeout_ms) + if ((UINT64_MAX / 2000 - 1) < ui_val) { #ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - _ ("The specified connection timeout (" PRIu64 ") is too " \ - "large. Maximum allowed value (" PRIu64 ") will be used " \ + _ ("The specified connection timeout (%u) is too " \ + "large. Maximum allowed value (%" PRIu64 ") will be used " \ "instead.\n"), - connection->connection_timeout_ms, + ui_val, (UINT64_MAX / 2000 - 1)); #endif - connection->connection_timeout_ms = UINT64_MAX / 2000 - 1; + ui_val = UINT64_MAX / 2000 - 1; } else #endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */ - connection->connection_timeout_ms *= 1000; + connection->connection_timeout_ms = ui_val * 1000; if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && (! connection->suspended) ) {