commit 2e7c3aebc7f24054aa5296a2678993edc8fa808d
parent 35ae3e8d78eb4175fcba760459b3da56b6d2e2c0
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sat, 22 Mar 2025 14:15:22 +0300
Refactored MHD_daemon_get_info_dynamic_sz() and relevant types
Resulting values now are individual for each query value.
Diffstat:
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
@@ -9447,15 +9447,15 @@ enum MHD_DaemonInfoDynamicType
* Available only for daemons stated in #MHD_WM_EXTERNAL_PERIODIC,
* #MHD_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL, #MHD_WM_EXTERNAL_EVENT_LOOP_CB_EDGE
* or #MHD_WM_EXTERNAL_SINGLE_FD_WATCH modes.
- * The function return #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if daemon has
+ * The function returns #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the daemon has
* internal handling of events (internal threads).
- * The result is placed in @a v_uint64 member.
+ * The result is placed in @a v_max_time_to_wait_uint64 member.
*/
MHD_DAEMON_INFO_DYNAMIC_MAX_TIME_TO_WAIT = 1
,
/**
* Check whether the daemon has any connected network clients.
- * The result is placed in @a v_bool member.
+ * The result is placed in @a v_has_connections_bool member.
*/
MHD_DAEMON_INFO_DYNAMIC_HAS_CONNECTIONS = 20
,
@@ -9475,14 +9475,14 @@ enum MHD_DaemonInfoDynamicType
union MHD_DaemonInfoDynamicData
{
/**
- * The boolean value
+ * The data for the #MHD_DAEMON_INFO_DYNAMIC_MAX_TIME_TO_WAIT query
*/
- enum MHD_Bool v_bool;
+ uint_fast64_t v_max_time_to_wait_uint64;
/**
- * Unsigned 64 bits integer value.
+ * The data for the #MHD_DAEMON_INFO_DYNAMIC_HAS_CONNECTIONS query
*/
- uint_fast64_t v_uint64;
+ enum MHD_Bool v_has_connections_bool;
/**
* Unused member.
diff --git a/src/include/microhttpd2_main.h.in b/src/include/microhttpd2_main.h.in
@@ -4825,15 +4825,15 @@ enum MHD_DaemonInfoDynamicType
* Available only for daemons stated in #MHD_WM_EXTERNAL_PERIODIC,
* #MHD_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL, #MHD_WM_EXTERNAL_EVENT_LOOP_CB_EDGE
* or #MHD_WM_EXTERNAL_SINGLE_FD_WATCH modes.
- * The function return #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if daemon has
+ * The function returns #MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE if the daemon has
* internal handling of events (internal threads).
- * The result is placed in @a v_uint64 member.
+ * The result is placed in @a v_max_time_to_wait_uint64 member.
*/
MHD_DAEMON_INFO_DYNAMIC_MAX_TIME_TO_WAIT = 1
,
/**
* Check whether the daemon has any connected network clients.
- * The result is placed in @a v_bool member.
+ * The result is placed in @a v_has_connections_bool member.
*/
MHD_DAEMON_INFO_DYNAMIC_HAS_CONNECTIONS = 20
,
@@ -4853,14 +4853,14 @@ enum MHD_DaemonInfoDynamicType
union MHD_DaemonInfoDynamicData
{
/**
- * The boolean value
+ * The data for the #MHD_DAEMON_INFO_DYNAMIC_MAX_TIME_TO_WAIT query
*/
- enum MHD_Bool v_bool;
+ uint_fast64_t v_max_time_to_wait_uint64;
/**
- * Unsigned 64 bits integer value.
+ * The data for the #MHD_DAEMON_INFO_DYNAMIC_HAS_CONNECTIONS query
*/
- uint_fast64_t v_uint64;
+ enum MHD_Bool v_has_connections_bool;
/**
* Unused member.
diff --git a/src/mhd2/daemon_get_info.c b/src/mhd2/daemon_get_info.c
@@ -158,12 +158,12 @@ MHD_daemon_get_info_dynamic_sz (
case MHD_DAEMON_INFO_DYNAMIC_MAX_TIME_TO_WAIT:
if (mhd_WM_INT_HAS_THREADS (daemon->wmode_int))
return MHD_SC_INFO_GET_TYPE_NOT_APPLICABLE;
- if (sizeof(output_buf->v_uint64) > output_buf_size)
+ if (sizeof(output_buf->v_max_time_to_wait_uint64) > output_buf_size)
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;
- output_buf->v_uint64 = mhd_daemon_get_wait_max (daemon);
+ output_buf->v_max_time_to_wait_uint64 = mhd_daemon_get_wait_max (daemon);
return MHD_SC_OK;
case MHD_DAEMON_INFO_DYNAMIC_HAS_CONNECTIONS:
- if (sizeof(output_buf->v_bool) <= output_buf_size)
+ if (sizeof(output_buf->v_has_connections_bool) <= output_buf_size)
{
enum MHD_Bool res;
/*
@@ -188,7 +188,7 @@ MHD_daemon_get_info_dynamic_sz (
}
}
}
- output_buf->v_bool = res;
+ output_buf->v_has_connections_bool = res;
return MHD_SC_OK;
}
return MHD_SC_INFO_GET_BUFF_TOO_SMALL;