Description: Fix build failure with GCC-14
Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
Forwarded: no
Last-Update: 2024-08-10
Bug-Debian: https://bugs.debian.org/1075141

    This is a lot of type casting which hopefully didn't break
    anything.

--- a/mod_encoding.c
+++ b/mod_encoding.c
@@ -192,7 +192,7 @@
 
   /* Normalize encoding in HTTP request line */
   query_string = apr_pstrdup(r->pool, r->unparsed_uri);
-  unparsed_uri = ap_getword(r->pool, &query_string, '?');
+  unparsed_uri = ap_getword(r->pool, (const char **) &query_string, '?');
   ap_unescape_url(unparsed_uri);
   if ((buff = iconv_string(r, cd, unparsed_uri,
 			   strlen(unparsed_uri))) == NULL)
@@ -242,7 +242,7 @@
 
 
   for (i = 0 ; i < encmap->nelts ; i += 2) {
-    if (ap_regexec((regex_t *)list[i], lookup, 0, NULL, 0) == 0) {
+    if (ap_regexec((const ap_regex_t *)list[i], lookup, 0, NULL, 0) == 0) {
       apr_array_cat(encs, (apr_array_header_t *)list[i + 1]);
       return encs;
     }
@@ -255,7 +255,8 @@
  * Handler for "EncodingEngine" directive.
  */
 static const char *
-set_encoding_engine(cmd_parms *cmd, encoding_config *conf, int flag) {
+set_encoding_engine(cmd_parms *cmd, void *_conf, int flag) {
+  encoding_config *conf = (encoding_config*) _conf;
 
   if (! cmd->path) {
     conf = ap_get_module_config(cmd->server->module_config, &encoding_module);
@@ -269,7 +270,8 @@
  * Handler for "SetServerEncoding" directive.
  */
 static const char *
-set_server_encoding(cmd_parms *cmd, encoding_config *conf, char *arg) {
+set_server_encoding(cmd_parms *cmd, void *_conf, const char *arg) {
+  encoding_config *conf = (encoding_config*) _conf;
 
   if (! cmd->path) {
     conf = ap_get_module_config(cmd->server->module_config, &encoding_module);
@@ -286,7 +288,8 @@
  * encoding(s) from that useragent.
  */
 static const char *
-add_client_encoding(cmd_parms *cmd, encoding_config *conf, char *args) {
+add_client_encoding(cmd_parms *cmd, void *_conf, const char *args) {
+  encoding_config *conf = (encoding_config*) _conf;
   apr_array_header_t    *encs;
   char            *arg;
 
@@ -298,13 +301,13 @@
   encs = apr_array_make(cmd->pool, 1, sizeof(void *));
 
   /* register useragent with UserAgent: pattern */
-  if (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) {
+  if (*args && (arg = ap_getword_conf(cmd->pool, &args))) {
     *(void **)apr_array_push(conf->client_encoding) =
       ap_pregcomp(cmd->pool, arg, REG_EXTENDED|REG_ICASE|REG_NOSUB);
   }
 
   /* register list of possible encodings from above useragent */
-  while (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) {
+  while (*args && (arg = ap_getword_conf(cmd->pool, &args))) {
     *(void **)apr_array_push(encs) = apr_pstrdup(cmd->pool, arg);
   }
   *(void **)apr_array_push(conf->client_encoding) = encs;
@@ -318,7 +321,8 @@
  * This registers encodings that work as "fallback" for most clients.
  */
 static const char *
-default_client_encoding(cmd_parms *cmd, encoding_config *conf, char *args) {
+default_client_encoding(cmd_parms *cmd, void *_conf, const char *args) {
+  encoding_config *conf = (encoding_config*) _conf;
   char *arg;
 
 
@@ -329,7 +333,7 @@
   conf->default_encoding = apr_array_make(cmd->pool, 1, sizeof(char *));
 
   /* register list of possible encodings as a default */
-  while (*args && (arg = ap_getword_conf_nc(cmd->pool, &args))) {
+  while (*args && (arg = ap_getword_conf(cmd->pool, &args))) {
     *(void **)apr_array_push(conf->default_encoding)
       = apr_pstrdup(cmd->pool, arg);
   }
@@ -344,8 +348,8 @@
  *       So where should this go?
  */
 static const char *
-set_normalize_username(cmd_parms *cmd, encoding_config *conf, int flag) {
-
+set_normalize_username(cmd_parms *cmd, void *_conf, int flag) {
+  encoding_config *conf = (encoding_config*) _conf;
   if (! cmd->path) {
     conf = ap_get_module_config(cmd->server->module_config, &encoding_module);
   }
@@ -362,23 +366,23 @@
 
 static const command_rec mod_enc_commands[] = {
   {"EncodingEngine",
-   set_encoding_engine, NULL,
+   .func.flag = set_encoding_engine, NULL,
    RSRC_CONF, FLAG,  "Usage: EncodingEngine (on|off)"},
 
   {"SetServerEncoding",
-   set_server_encoding, NULL,
+   .func.take1 = set_server_encoding, NULL,
    RSRC_CONF, TAKE1, "Usage: SetServerEncoding <enc>"},
 
   {"AddClientEncoding",
-   add_client_encoding, NULL,
+   .func.raw_args = add_client_encoding, NULL,
    RSRC_CONF, RAW_ARGS, "Usage: AddClientEncoding <agent> <enc> [<enc> ...]"},
 
   {"DefaultClientEncoding",
-   default_client_encoding, NULL,
+   .func.raw_args = default_client_encoding, NULL,
    RSRC_CONF, RAW_ARGS, "Usage: DefaultClientEncoding <enclist>"},
 
   {"NormalizeUsername",
-   set_normalize_username, NULL,
+   .func.flag = set_normalize_username, NULL,
    RSRC_CONF|ACCESS_CONF, FLAG, "Usage: NormalizeUsername (on|off)"},
 
   {NULL}
