ben 98/06/14 14:10:38
Modified: src/main http_protocol.c src/modules/example mod_example.c src/modules/standard mod_log_agent.c mod_log_config.c mod_log_referer.c mod_mime.c mod_mime_magic.c mod_negotiation.c mod_unique_id.c Log: Deal with gcc's broken failure to cast char ** to const char **. Revision Changes Path 1.220 +1 -1 apache-1.3/src/main/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v retrieving revision 1.219 retrieving revision 1.220 diff -u -r1.219 -r1.220 --- http_protocol.c 1998/06/13 15:22:53 1.219 +++ http_protocol.c 1998/06/14 21:10:20 1.220 @@ -173,7 +173,7 @@ } else { /* a multiple range */ - char *r_range = ap_pstrdup(r->pool, range + 6); + const char *r_range = ap_pstrdup(r->pool, range + 6); long tlength = 0; r->byterange = 2; 1.31 +3 -3 apache-1.3/src/modules/example/mod_example.c Index: mod_example.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/example/mod_example.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- mod_example.c 1998/05/06 11:14:43 1.30 +++ mod_example.c 1998/06/14 21:10:25 1.31 @@ -116,7 +116,7 @@ * the first time (non-request context only), and ignore subsequent calls for * the same routine/environment. */ -static char *trace = NULL; +static const char *trace = NULL; static table *static_calls_made = NULL; /* @@ -329,11 +329,11 @@ const char *note) { - char *sofar; + const char *sofar; char *addon; char *where; pool *p; - char *trace_copy; + const char *trace_copy; /* * Make sure our pools and tables are set up - we need 'em. 1.29 +1 -1 apache-1.3/src/modules/standard/mod_log_agent.c Index: mod_log_agent.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_log_agent.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- mod_log_agent.c 1998/05/29 08:18:51 1.28 +++ mod_log_agent.c 1998/06/14 21:10:26 1.29 @@ -144,7 +144,7 @@ &agent_log_module); char str[HUGE_STRING_LEN]; - char *agent; + const char *agent; request_rec *r; if (cls->agent_fd < 0) 1.62 +26 -24 apache-1.3/src/modules/standard/mod_log_config.c Index: mod_log_config.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_log_config.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- mod_log_config.c 1998/06/13 15:23:09 1.61 +++ mod_log_config.c 1998/06/14 21:10:27 1.62 @@ -244,9 +244,10 @@ /* * Format items... + * Note that many of these could have ap_sprintfs replaced with static buffers. */ -typedef char *(*item_key_func) (request_rec *, char *); +typedef const char *(*item_key_func) (request_rec *, char *); typedef struct { item_key_func func; @@ -271,28 +272,28 @@ } } -static char *constant_item(request_rec *dummy, char *stuff) +static const char *constant_item(request_rec *dummy, char *stuff) { return stuff; } -static char *log_remote_host(request_rec *r, char *a) +static const char *log_remote_host(request_rec *r, char *a) { - return (char *) ap_get_remote_host(r->connection, r->per_dir_config, + return ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME); } -static char *log_remote_address(request_rec *r, char *a) +static const char *log_remote_address(request_rec *r, char *a) { return r->connection->remote_ip; } -static char *log_remote_logname(request_rec *r, char *a) +static const char *log_remote_logname(request_rec *r, char *a) { - return (char *) ap_get_remote_logname(r); + return ap_get_remote_logname(r); } -static char *log_remote_user(request_rec *r, char *a) +static const char *log_remote_user(request_rec *r, char *a) { char *rvalue = r->connection->user; @@ -305,7 +306,7 @@ return rvalue; } -static char *log_request_line(request_rec *r, char *a) +static const char *log_request_line(request_rec *r, char *a) { /* NOTE: If the original request contained a password, we * re-write the request line here to contain XXXXXX instead: @@ -318,20 +319,20 @@ : r->the_request; } -static char *log_request_file(request_rec *r, char *a) +static const char *log_request_file(request_rec *r, char *a) { return r->filename; } -static char *log_request_uri(request_rec *r, char *a) +static const char *log_request_uri(request_rec *r, char *a) { return r->uri; } -static char *log_status(request_rec *r, char *a) +static const char *log_status(request_rec *r, char *a) { return pfmt(r->pool, r->status); } -static char *log_bytes_sent(request_rec *r, char *a) +static const char *log_bytes_sent(request_rec *r, char *a) { if (!r->sent_bodyct) { return "-"; @@ -369,11 +370,11 @@ return ap_table_get(r->subprocess_env, a); } -static char *log_request_time(request_rec *r, char *a) +static const char *log_request_time(request_rec *r, char *a) { int timz; struct tm *t; - char tstr[MAX_STRING_LEN]; + static char tstr[MAX_STRING_LEN]; t = ap_get_gmtoff(&timz); @@ -394,10 +395,10 @@ "%c%.2d%.2d]", sign, timz / 60, timz % 60); } - return ap_pstrdup(r->pool, tstr); + return tstr; } -static char *log_request_duration(request_rec *r, char *a) +static const char *log_request_duration(request_rec *r, char *a) { return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time); } @@ -405,17 +406,17 @@ /* These next two routines use the canonical name:port so that log * parsers don't need to duplicate all the vhost parsing crud. */ -static char *log_virtual_host(request_rec *r, char *a) +static const char *log_virtual_host(request_rec *r, char *a) { - return ap_pstrdup(r->pool, ap_get_server_name(r)); + return ap_get_server_name(r); } -static char *log_server_port(request_rec *r, char *a) +static const char *log_server_port(request_rec *r, char *a) { return ap_psprintf(r->pool, "%u", ap_get_server_port(r)); } -static char *log_child_pid(request_rec *r, char *a) +static const char *log_child_pid(request_rec *r, char *a) { return ap_psprintf(r->pool, "%ld", (long) getpid()); } @@ -636,10 +637,10 @@ * Actually logging. */ -static char *process_item(request_rec *r, request_rec *orig, +static const char *process_item(request_rec *r, request_rec *orig, log_format_item *item) { - char *cp; + const char *cp; /* First, see if we need to process this thing at all... */ @@ -681,7 +682,8 @@ array_header *default_format) { log_format_item *items; - char *str, **strs, *s; + char *str, *s; + const char **strs; int *strl; request_rec *orig; int i; 1.32 +2 -1 apache-1.3/src/modules/standard/mod_log_referer.c Index: mod_log_referer.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_log_referer.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- mod_log_referer.c 1998/05/29 08:18:51 1.31 +++ mod_log_referer.c 1998/06/14 21:10:27 1.32 @@ -162,7 +162,8 @@ &referer_log_module); char *str; - char *referer, *referertest; + const char *referer; + char *referertest; request_rec *r; if (cls->referer_fd < 0) 1.43 +1 -1 apache-1.3/src/modules/standard/mod_mime.c Index: mod_mime.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- mod_mime.c 1998/06/13 15:23:10 1.42 +++ mod_mime.c 1998/06/14 21:10:27 1.43 @@ -280,7 +280,7 @@ r->content_language = type; /* back compat. only */ if (!r->content_languages) r->content_languages = ap_make_array(r->pool, 2, sizeof(char *)); - new = (char **) ap_push_array(r->content_languages); + new = (const char **) ap_push_array(r->content_languages); *new = type; found = 1; } 1.35 +8 -4 apache-1.3/src/modules/standard/mod_mime_magic.c Index: mod_mime_magic.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime_magic.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- mod_mime_magic.c 1998/06/10 09:02:13 1.34 +++ mod_mime_magic.c 1998/06/14 21:10:28 1.35 @@ -813,17 +813,21 @@ /* save the info in the request record */ if (state == rsl_subtype || state == rsl_encoding || state == rsl_encoding) { - r->content_type = rsl_strdup(r, type_frag, type_pos, type_len); + char *tmp; + tmp = rsl_strdup(r, type_frag, type_pos, type_len); /* XXX: this could be done at config time I'm sure... but I'm * confused by all this magic_rsl stuff. -djg */ - ap_content_type_tolower(r->content_type); + ap_content_type_tolower(tmp); + r->content_type = tmp; } if (state == rsl_encoding) { - r->content_encoding = rsl_strdup(r, encoding_frag, + char *tmp; + tmp = rsl_strdup(r, encoding_frag, encoding_pos, encoding_len); /* XXX: this could be done at config time I'm sure... but I'm * confused by all this magic_rsl stuff. -djg */ - ap_str_tolower(r->content_encoding); + ap_str_tolower(tmp); + r->content_encoding = tmp; } /* detect memory allocation errors */ 1.82 +6 -4 apache-1.3/src/modules/standard/mod_negotiation.c Index: mod_negotiation.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_negotiation.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- mod_negotiation.c 1998/06/13 15:23:10 1.81 +++ mod_negotiation.c 1998/06/14 21:10:28 1.82 @@ -429,7 +429,7 @@ * return an array containing the languages of this variant */ -static array_header *do_languages_line(pool *p, char **lang_line) +static array_header *do_languages_line(pool *p, const char **lang_line) { array_header *lang_recs = ap_make_array(p, 2, sizeof(char *)); @@ -724,13 +724,15 @@ hstate = get_header_line(buffer, MAX_STRING_LEN, map); if (hstate == header_seen) { - char *body = lcase_header_name_return_body(buffer, neg->r); + char *body1 = lcase_header_name_return_body(buffer, neg->r); + const char *body; - if (body == NULL) { + if (body1 == NULL) { return SERVER_ERROR; } - strip_paren_comments(body); + strip_paren_comments(body1); + body=body1; if (!strncmp(buffer, "uri:", 4)) { mime_info.file_name = ap_get_token(neg->pool, &body, 0); 1.17 +1 -1 apache-1.3/src/modules/standard/mod_unique_id.c Index: mod_unique_id.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_unique_id.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- mod_unique_id.c 1998/06/08 05:32:24 1.16 +++ mod_unique_id.c 1998/06/14 21:10:29 1.17 @@ -322,7 +322,7 @@ } paddedbuf; unsigned char *x,*y; unsigned short counter; - char *e; + const char *e; int i,j,k; /* copy the unique_id if this is an internal redirect (we're never