From: Takashi Sato Date: Tue, 29 Dec 2009 12:34:26 +0000 (+0000) Subject: Fix string constness to get rid of gcc compiler warnings by -Wwrite-strings. X-Git-Tag: 2.3.5~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0534f5f339e9d7c59e9101a072622150cb22bf0c;p=apache Fix string constness to get rid of gcc compiler warnings by -Wwrite-strings. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894368 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/core.c b/server/core.c index b942e1e52a..7c37861aaf 100644 --- a/server/core.c +++ b/server/core.c @@ -2682,7 +2682,7 @@ AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r) static char *server_banner = NULL; static int banner_locked = 0; -static char *server_description = NULL; +static const char *server_description = NULL; enum server_token_type { SrvTk_MAJOR, /* eg: Apache/2 */ diff --git a/server/log.c b/server/log.c index 3733797dfd..7e224a6d02 100644 --- a/server/log.c +++ b/server/log.c @@ -50,8 +50,8 @@ #include "ap_mpm.h" typedef struct { - char *t_name; - int t_val; + const char *t_name; + int t_val; } TRANS; APR_HOOK_STRUCT( diff --git a/server/request.c b/server/request.c index f34f9f5723..97e0803c2f 100644 --- a/server/request.c +++ b/server/request.c @@ -89,7 +89,7 @@ static int auth_internal_per_conf_hooks = 0; static int auth_internal_per_conf_providers = 0; -static int decl_die(int status, char *phase, request_rec *r) +static int decl_die(int status, const char *phase, request_rec *r) { if (status == DECLINED) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, diff --git a/server/util_cookies.c b/server/util_cookies.c index 82afba1b68..8f1504c7bd 100644 --- a/server/util_cookies.c +++ b/server/util_cookies.c @@ -35,8 +35,8 @@ AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name, cons const char *attrs, long maxage, ...) { - char *buffer; - char *rfc2109; + const char *buffer; + const char *rfc2109; apr_table_t *t; va_list vp; @@ -79,8 +79,8 @@ AP_DECLARE(apr_status_t) ap_cookie_write2(request_rec * r, const char *name2, co const char *attrs2, long maxage, ...) { - char *buffer; - char *rfc2965; + const char *buffer; + const char *rfc2965; apr_table_t *t; va_list vp; @@ -121,7 +121,7 @@ AP_DECLARE(apr_status_t) ap_cookie_remove(request_rec * r, const char *name, con va_list vp; /* create RFC2109 compliant cookie */ - char *rfc2109 = apr_pstrcat(r->pool, name, "=;Max-Age=0;", + const char *rfc2109 = apr_pstrcat(r->pool, name, "=;Max-Age=0;", attrs ? attrs : CLEAR_ATTRS, NULL); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, LOG_PREFIX "user '%s' removed cookie: '%s'", r->user, rfc2109); @@ -149,7 +149,7 @@ AP_DECLARE(apr_status_t) ap_cookie_remove2(request_rec * r, const char *name2, c va_list vp; /* create RFC2965 compliant cookie */ - char *rfc2965 = apr_pstrcat(r->pool, name2, "=;Max-Age=0;", + const char *rfc2965 = apr_pstrcat(r->pool, name2, "=;Max-Age=0;", attrs2 ? attrs2 : CLEAR_ATTRS, NULL); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, LOG_PREFIX "user '%s' removed cookie2: '%s'", r->user, rfc2965); @@ -178,7 +178,7 @@ static int extract_cookie_line(ap_cookie_do * v, const char *key, const char *va char *cookie = apr_pstrdup(v->r->pool, val); const char *name = apr_pstrcat(v->r->pool, v->name ? v->name : "", "=", NULL); size_t len = strlen(name); - char *new_cookie = ""; + const char *new_cookie = ""; const char *comma = ","; char *next1; const char *semi = ";"; diff --git a/server/util_script.c b/server/util_script.c index 58983079de..0a7a8a6dd5 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -121,9 +121,9 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r) server_rec *s = r->server; conn_rec *c = r->connection; const char *rem_logname; - char *env_path; + const char *env_path; #if defined(WIN32) || defined(OS2) - char *env_temp; + const char *env_temp; #endif const char *host; const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);