Refactored MHD_daemon_get_info_dynamic_sz() and relevant types

Resulting values now are individual for each query value.
This commit is contained in:
Evgeny Grin (Karlson2k)
2025-03-22 15:21:33 +03:00
parent 9452064684
commit 7e765653dd
3 changed files with 18 additions and 18 deletions
+7 -7
View File
@@ -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.
+7 -7
View File
@@ -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.
+4 -4
View File
@@ -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;