tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jean-frederic clere <jfrederic.cl...@fujitsu-siemens.com>
Subject Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_map.c jk_map.h jk_util.c jk_util.h
Date Wed, 05 Sep 2001 17:25:14 GMT
Hi,

I would like to comment the following:

Some of the "const" are causing a lot of warnings, I have stopped fixed because
I was afraid to have to change too much things... (I have put /* DIRTY */ where
I have stopped forwarding the const).

Any comment?

Cheers

Jean-frederic

jfclere@apache.org wrote:
> 
> jfclere     01/09/05 10:05:24
> 
>   Modified:    jk/native/apache-2.0 mod_jk.c
>                jk/native/common jk_map.c jk_map.h jk_util.c jk_util.h
>   Log:
>   Get ride of some warnings - But there is still a lot to do with const -
>   I have put /* DIRTY */ where the cast looks weird.
> 
>   Revision  Changes    Path
>   1.21      +65 -51    jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
> 
>   Index: mod_jk.c
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
>   retrieving revision 1.20
>   retrieving revision 1.21
>   diff -u -r1.20 -r1.21
>   --- mod_jk.c  2001/09/05 14:43:48     1.20
>   +++ mod_jk.c  2001/09/05 17:05:23     1.21
>   @@ -60,7 +60,7 @@
>     * Description: Apache 2 plugin for Jakarta/Tomcat                         *
>     * Author:      Gal Shachor <shachor@il.ibm.com>                           *
>     *                 Henri Gomez <hgomez@slib.fr>                            
  *
>   - * Version:     $Revision: 1.20 $                                           *
>   + * Version:     $Revision: 1.21 $                                           *
>     ***************************************************************************/
> 
>    /*
>   @@ -565,9 +565,9 @@
> 
>    static const char *jk_mount_context(cmd_parms *cmd,
>                                        void *dummy,
>   -                                    char *context,
>   -                                    char *worker,
>   -                                    char *maybe_cookie)
>   +                                    const char *context,
>   +                                    const char *worker,
>   +                                    const char *maybe_cookie)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>   @@ -591,8 +591,8 @@
> 
>    static const char *jk_automount_context(cmd_parms *cmd,
>                                            void *dummy,
>   -                                        char *worker,
>   -                                        char *virtualhost)
>   +                                        const char *worker,
>   +                                        const char *virtualhost)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>   @@ -614,7 +614,7 @@
> 
>    static const char *jk_set_worker_file(cmd_parms *cmd,
>                                          void *dummy,
>   -                                      char *worker_file)
>   +                                      const char *worker_file)
>    {
>        server_rec *s = cmd->server;
>        struct stat statbuf;
>   @@ -642,7 +642,7 @@
> 
>    static const char *jk_set_log_file(cmd_parms *cmd,
>                                       void *dummy,
>   -                                   char *log_file)
>   +                                   const char *log_file)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>   @@ -665,7 +665,7 @@
> 
>    static const char *jk_set_log_level(cmd_parms *cmd,
>                                        void *dummy,
>   -                                    char *log_level)
>   +                                    const char *log_level)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>   @@ -684,7 +684,7 @@
> 
>    static const char * jk_set_log_fmt(cmd_parms *cmd,
>                          void *dummy,
>   -                      char * log_format)
>   +                      const char * log_format)
>    {
>        jk_set_log_format(log_format);
>        return NULL;
>   @@ -718,13 +718,13 @@
> 
>    static const char *jk_set_https_indicator(cmd_parms *cmd,
>                                              void *dummy,
>   -                                          char *indicator)
>   +                                          const char *indicator)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>            (jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module);
> 
>   -    conf->https_indicator = indicator;
>   +    conf->https_indicator = ap_pstrdup(cmd->pool,indicator);
> 
>        return NULL;
>    }
>   @@ -737,13 +737,13 @@
> 
>    static const char *jk_set_certs_indicator(cmd_parms *cmd,
>                                              void *dummy,
>   -                                          char *indicator)
>   +                                          const char *indicator)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>            (jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module);
> 
>   -    conf->certs_indicator = indicator;
>   +    conf->certs_indicator = ap_pstrdup(cmd->pool,indicator);
> 
>        return NULL;
>    }
>   @@ -756,13 +756,13 @@
> 
>    static const char *jk_set_cipher_indicator(cmd_parms *cmd,
>                                               void *dummy,
>   -                                           char *indicator)
>   +                                           const char *indicator)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>            (jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module);
> 
>   -    conf->cipher_indicator = indicator;
>   +    conf->cipher_indicator = ap_pstrdup(cmd->pool,indicator);
> 
>        return NULL;
>    }
>   @@ -775,13 +775,13 @@
> 
>    static const char *jk_set_session_indicator(cmd_parms *cmd,
>                                               void *dummy,
>   -                                           char *indicator)
>   +                                           const char *indicator)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>            (jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module);
> 
>   -    conf->session_indicator = indicator;
>   +    conf->session_indicator = ap_pstrdup(cmd->pool,indicator);
> 
>        return NULL;
>    }
>   @@ -794,13 +794,13 @@
> 
>    static const char *jk_set_key_size_indicator(cmd_parms *cmd,
>                                               void *dummy,
>   -                                           char *indicator)
>   +                                           const char *indicator)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>            (jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module);
> 
>   -    conf->key_size_indicator = indicator;
>   +    conf->key_size_indicator = ap_pstrdup(cmd->pool,indicator);
> 
>        return NULL;
>    }
>   @@ -813,8 +813,8 @@
> 
>    static const char *jk_add_env_var(cmd_parms *cmd,
>                                      void *dummy,
>   -                                  char *env_name,
>   -                                  char *default_value)
>   +                                  const char *env_name,
>   +                                  const char *default_value)
>    {
>        server_rec *s = cmd->server;
>        jk_server_conf_t *conf =
>   @@ -836,42 +836,49 @@
>         * This file defines the different workers used by apache to redirect
>         * servlet requests.
>         */
>   -    {"JkWorkersFile", jk_set_worker_file, NULL, RSRC_CONF, TAKE1,
>   -     "the name of a worker file for the Jakarta servlet containers"},
>   +    AP_INIT_TAKE1(
>   +        "JkWorkersFile", jk_set_worker_file, NULL, RSRC_CONF,
>   +        "the name of a worker file for the Jakarta servlet containers"),
> 
>        /*
>         * JkAutoMount specifies that the list of handled URLs must be
>         * asked to the servlet engine (autoconf feature)
>         */
>   -    {"JkAutoMount", jk_automount_context, NULL, RSRC_CONF, TAKE12,
>   -     "automatic mount points to a Tomcat worker"},
>   +    AP_INIT_TAKE12(
>   +        "JkAutoMount", jk_automount_context, NULL, RSRC_CONF,
>   +        "automatic mount points to a Tomcat worker"),
> 
>        /*
>         * JkMount mounts a url prefix to a worker (the worker need to be
>         * defined in the worker properties file.
>         */
>   -    {"JkMount", jk_mount_context, NULL, RSRC_CONF, TAKE23,
>   -     "A mount point from a context to a Tomcat worker"},
>   +    AP_INIT_TAKE23(
>   +        "JkMount", jk_mount_context, NULL, RSRC_CONF,
>   +        "A mount point from a context to a Tomcat worker"),
> 
>        /*
>         * JkMountCopy specifies if mod_jk should copy the mount points
>         * from the main server to the virtual servers.
>         */
>   -    {"JkMountCopy", jk_set_mountcopy, NULL, RSRC_CONF, FLAG,
>   -     "Should the base server mounts be copied to the virtual server"},
>   +    AP_INIT_FLAG(
>   +        "JkMountCopy", jk_set_mountcopy, NULL, RSRC_CONF,
>   +        "Should the base server mounts be copied to the virtual server"),
> 
>        /*
>         * JkLogFile & JkLogLevel specifies to where should the plugin log
>         * its information and how much.
>         * JkLogStampFormat specify the time-stamp to be used on log
>         */
>   -    {"JkLogFile", jk_set_log_file, NULL, RSRC_CONF, TAKE1,
>   -     "Full path to the Jakarta Tomcat module log file"},
>   -    {"JkLogLevel", jk_set_log_level, NULL, RSRC_CONF, TAKE1,
>   -     "The Jakarta Tomcat module log level, can be debug, "
>   -     "info, error or emerg"},
>   -    {"JkLogStampFormat", jk_set_log_fmt, NULL, RSRC_CONF, TAKE1,
>   -     "The Jakarta Tomcat module log format, follow strftime synthax"},
>   +    AP_INIT_TAKE1(
>   +        "JkLogFile", jk_set_log_file, NULL, RSRC_CONF,
>   +        "Full path to the Jakarta Tomcat module log file"),
>   +    AP_INIT_TAKE1(
>   +        "JkLogLevel", jk_set_log_level, NULL, RSRC_CONF,
>   +        "The Jakarta Tomcat module log level, can be debug, "
>   +        "info, error or emerg"),
>   +    AP_INIT_TAKE1(
>   +        "JkLogStampFormat", jk_set_log_fmt, NULL, RSRC_CONF,
>   +        "The Jakarta Tomcat module log format, follow strftime synthax"),
> 
>        /*
>         * Apache has multiple SSL modules (for example apache_ssl, stronghold
>   @@ -885,26 +892,33 @@
>         * KEYSIZE - Size of Key used in dialogue (#bits are secure)
>         * SESSION - A string specifing the current SSL session.
>         */
>   -    {"JkHTTPSIndicator", jk_set_https_indicator, NULL, RSRC_CONF, TAKE1,
>   -     "Name of the Apache environment that contains SSL indication"},
>   -    {"JkCERTSIndicator", jk_set_certs_indicator, NULL, RSRC_CONF, TAKE1,
>   -     "Name of the Apache environment that contains SSL client certificates"},
>   -    {"JkCIPHERIndicator", jk_set_cipher_indicator, NULL, RSRC_CONF, TAKE1,
>   -     "Name of the Apache environment that contains SSL client cipher"},
>   -    {"JkSESSIONIndicator", jk_set_session_indicator, NULL, RSRC_CONF, TAKE1,
>   -     "Name of the Apache environment that contains SSL session"},
>   -    {"JkKEYSIZEIndicator", jk_set_key_size_indicator, NULL, RSRC_CONF, TAKE1,
>   -     "Name of the Apache environment that contains SSL key size in use"},
>   -    {"JkExtractSSL", jk_set_enable_ssl, NULL, RSRC_CONF, FLAG,
>   -     "Turns on SSL processing and information gathering by mod_jk"},
>   +    AP_INIT_TAKE1(
>   +        "JkHTTPSIndicator", jk_set_https_indicator, NULL, RSRC_CONF,
>   +        "Name of the Apache environment that contains SSL indication"),
>   +    AP_INIT_TAKE1(
>   +        "JkCERTSIndicator", jk_set_certs_indicator, NULL, RSRC_CONF,
>   +        "Name of the Apache environment that contains SSL client certificates"),
>   +    AP_INIT_TAKE1(
>   +        "JkCIPHERIndicator", jk_set_cipher_indicator, NULL, RSRC_CONF,
>   +        "Name of the Apache environment that contains SSL client cipher"),
>   +    AP_INIT_TAKE1(
>   +        "JkSESSIONIndicator", jk_set_session_indicator, NULL, RSRC_CONF,
>   +        "Name of the Apache environment that contains SSL session"),
>   +    AP_INIT_TAKE1(
>   +        "JkKEYSIZEIndicator", jk_set_key_size_indicator, NULL, RSRC_CONF,
>   +        "Name of the Apache environment that contains SSL key size in use"),
>   +    AP_INIT_FLAG(
>   +        "JkExtractSSL", jk_set_enable_ssl, NULL, RSRC_CONF,
>   +        "Turns on SSL processing and information gathering by mod_jk"),
> 
>        /*
>         * JkEnvVar let user defines envs var passed from WebServer to
>         * Servlet Engine
>         */
>   -    {"JkEnvVar", jk_add_env_var, NULL, RSRC_CONF, TAKE2,
>   -     "Adds a name of environment variable that should be sent "
>   -     "to servlet-engine"},
>   +    AP_INIT_TAKE2(
>   +        "JkEnvVar", jk_add_env_var, NULL, RSRC_CONF,
>   +        "Adds a name of environment variable that should be sent "
>   +        "to servlet-engine"),
> 
>        {NULL}
>    };
> 
> 
> 
>   1.5       +11 -11    jakarta-tomcat-connectors/jk/native/common/jk_map.c
> 
>   Index: jk_map.c
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_map.c,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- jk_map.c  2001/07/02 21:13:41     1.4
>   +++ jk_map.c  2001/09/05 17:05:23     1.5
>   @@ -58,7 +58,7 @@
>    /***************************************************************************
>     * Description: General purpose map object                                 *
>     * Author:      Gal Shachor <shachor@il.ibm.com>                           *
>   - * Version:     $Revision: 1.4 $                                           *
>   + * Version:     $Revision: 1.5 $                                           *
>     ***************************************************************************/
> 
>    #include "jk_global.h"
>   @@ -74,8 +74,8 @@
>        jk_pool_t p;
>        jk_pool_atom_t buf[SMALL_POOL_SIZE];
> 
>   -    char **names;
>   -    void **values;
>   +    const char **names;
>   +    const void **values;
> 
>        unsigned capacity;
>        unsigned size;
>   @@ -140,7 +140,7 @@
>                  const char *name,
>                  const void *def)
>    {
>   -    void *rc = (void *)def;
>   +    const void *rc = (void *)def;
> 
>        if(m && name) {
>            unsigned i;
>   @@ -152,7 +152,7 @@
>            }
>        }
> 
>   -    return rc;
>   +    return (void *)rc; /* DIRTY */
>    }
> 
>    int map_get_int(jk_map_t *m,
>   @@ -255,7 +255,7 @@
> 
>    int map_put(jk_map_t *m,
>                const char *name,
>   -            void *value,
>   +            const void *value,
>                void **old)
>    {
>        int rc = JK_FALSE;
>   @@ -269,7 +269,7 @@
>            }
> 
>            if(i < m->size) {
>   -            *old = m->values[i];
>   +            *old = (void *) m->values[i]; /* DIRTY */
>                m->values[i] = value;
>                rc = JK_TRUE;
>            } else {
>   @@ -362,7 +362,7 @@
>                      int idex)
>    {
>        if(m && idex >= 0) {
>   -        return m->names[idex];
>   +        return (char *)m->names[idex]; /* DIRTY */
>        }
> 
>        return NULL;
>   @@ -372,7 +372,7 @@
>                       int idex)
>    {
>        if(m && idex >= 0) {
>   -        return m->values[idex];
>   +        return (void *) m->values[idex]; /* DIRTY */
>        }
> 
>        return NULL;
>   @@ -422,8 +422,8 @@
>                if (m->capacity && m->values)
>                    memcpy(values, m->values, sizeof(void *) * m->capacity);
> 
>   -            m->names = names;
>   -            m->values = values;
>   +            m->names = (const char **)names;
>   +            m->values = (const void **)values;
>                m->capacity = capacity;
> 
>                return JK_TRUE;
> 
> 
> 
>   1.3       +2 -2      jakarta-tomcat-connectors/jk/native/common/jk_map.h
> 
>   Index: jk_map.h
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_map.h,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- jk_map.h  2001/06/18 14:15:52     1.2
>   +++ jk_map.h  2001/09/05 17:05:23     1.3
>   @@ -58,7 +58,7 @@
>    /***************************************************************************
>     * Description: Map object header file                                     *
>     * Author:      Gal Shachor <shachor@il.ibm.com>                           *
>   - * Version:     $Revision: 1.2 $                                           *
>   + * Version:     $Revision: 1.3 $                                           *
>     ***************************************************************************/
> 
>    #ifndef JK_MAP_H
>   @@ -104,7 +104,7 @@
> 
>    int map_put(jk_map_t *m,
>                const char *name,
>   -            void *value,
>   +            const void *value,
>                void **old);
> 
>    int map_read_properties(jk_map_t *m,
> 
> 
> 
>   1.6       +3 -3      jakarta-tomcat-connectors/jk/native/common/jk_util.c
> 
>   Index: jk_util.c
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_util.c,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- jk_util.c 2001/06/18 14:16:12     1.5
>   +++ jk_util.c 2001/09/05 17:05:23     1.6
>   @@ -59,7 +59,7 @@
>     * Description: Utility functions (mainly configuration)                   *
>     * Author:      Gal Shachor <shachor@il.ibm.com>                           *
>     * Author:      Henri Gomez <hgomez@slib.fr>                               *
>   - * Version:     $Revision: 1.5 $                                           *
>   + * Version:     $Revision: 1.6 $                                           *
>     ***************************************************************************/
> 
> 
>   @@ -110,7 +110,7 @@
>    #define JK_TIME_FORMAT "[%a %b %d %H:%M:%S %Y] "
>    #endif
> 
>   -char * jk_log_fmt = JK_TIME_FORMAT;
>   +const char * jk_log_fmt = JK_TIME_FORMAT;
> 
>    static void set_time_str(char * str, int len)
>    {
>   @@ -402,7 +402,7 @@
>        return JK_FALSE;
>    }
> 
>   -void jk_set_log_format(char * logformat)
>   +void jk_set_log_format(const char * logformat)
>    {
>         jk_log_fmt = (logformat) ? logformat : JK_TIME_FORMAT;
>    }
> 
> 
> 
>   1.4       +2 -2      jakarta-tomcat-connectors/jk/native/common/jk_util.h
> 
>   Index: jk_util.h
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_util.h,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- jk_util.h 2001/06/18 14:16:13     1.3
>   +++ jk_util.h 2001/09/05 17:05:23     1.4
>   @@ -59,7 +59,7 @@
>     * Description: Various utility functions                                  *
>     * Author:      Gal Shachor <shachor@il.ibm.com>                           *
>     * Author:      Henri Gomez <hgomez@slib.fr>                               *
>   - * Version:     $Revision: 1.3 $                                           *
>   + * Version:     $Revision: 1.4 $                                           *
>     ***************************************************************************/
>    #ifndef _JK_UTIL_H
>    #define _JK_UTIL_H
>   @@ -113,7 +113,7 @@
>    char * jk_get_worker_secret_key(jk_map_t *m,
>                                    const char *wname);
> 
>   -void jk_set_log_format(char *logformat);
>   +void jk_set_log_format(const char *logformat);
> 
>    int jk_get_worker_list(jk_map_t *m,
>                           char ***list,
> 
> 
>

Mime
View raw message