From: William A. Rowe Jr Date: Tue, 1 Dec 2009 08:44:11 +0000 (+0000) Subject: Elaborate on low hanging XXX fruit X-Git-Tag: 2.3.5~113 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e338e488c706c2ccb157ae0b22986df937e6e5a;p=thirdparty%2Fapache%2Fhttpd.git Elaborate on low hanging XXX fruit git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@885689 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c index 63c95755528..fa0c8a515ec 100644 --- a/modules/aaa/mod_auth_digest.c +++ b/modules/aaa/mod_auth_digest.c @@ -188,8 +188,8 @@ static const char *client_shm_filename; #define DEF_NUM_BUCKETS 15L #define HASH_DEPTH 5 -static long shmem_size = DEF_SHMEM_SIZE; -static long num_buckets = DEF_NUM_BUCKETS; +static apr_size_t shmem_size = DEF_SHMEM_SIZE; +static unsigned long num_buckets = DEF_NUM_BUCKETS; module AP_MODULE_DECLARE_DATA auth_digest_module; diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c index b3817496eec..31c85fe1c1a 100644 --- a/modules/cache/mod_disk_cache.c +++ b/modules/cache/mod_disk_cache.c @@ -1082,8 +1082,8 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r, file_cache_errorcleanup(dobj, r); return APR_EGENERAL; } - if (cl_header) { - apr_size_t cl = apr_atoi64(cl_header); + if (cl_header > 0) { + apr_size_t cl = (apr_size_t) apr_atoi64(cl_header); if ((errno == 0) && (dobj->file_size != cl)) { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "disk_cache: URL %s didn't receive complete response, not caching", diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c index 9933ca77dea..1e4a92341fb 100644 --- a/modules/cluster/mod_heartmonitor.c +++ b/modules/cluster/mod_heartmonitor.c @@ -230,7 +230,7 @@ static apr_status_t hm_file_update_stat(hm_ctx_t *ctx, hm_server_t *s, apr_pool_ apr_file_t *fp; apr_file_t *fpin; apr_time_t now; - unsigned int fage; + apr_time_t fage; apr_finfo_t fi; int updated = 0; char *path = apr_pstrcat(pool, ctx->storage_path, ".tmp.XXXXXX", NULL); @@ -266,7 +266,7 @@ static apr_status_t hm_file_update_stat(hm_ctx_t *ctx, hm_server_t *s, apr_pool_ bb = apr_brigade_create(pool, ba); apr_brigade_insert_file(bb, fpin, 0, fi.size, pool); tmpbb = apr_brigade_create(pool, ba); - fage = (unsigned int) apr_time_sec(now - fi.mtime); + fage = apr_time_sec(now - fi.mtime); do { char buf[4096]; const char *ip; @@ -300,7 +300,7 @@ static apr_status_t hm_file_update_stat(hm_ctx_t *ctx, hm_server_t *s, apr_pool_ apr_file_printf(fp, "%s\n", buf); } else if (strcmp(ip, s->ip) !=0 ) { hm_server_t node; - unsigned int seen; + apr_time_t seen; /* Update seen time according to the last file modification */ apr_table_clear(hbt); qs_to_table(apr_pstrdup(pool, t), hbt, pool); diff --git a/modules/proxy/balancers/mod_lbmethod_heartbeat.c b/modules/proxy/balancers/mod_lbmethod_heartbeat.c index ac859186b08..a1dc2ca6875 100644 --- a/modules/proxy/balancers/mod_lbmethod_heartbeat.c +++ b/modules/proxy/balancers/mod_lbmethod_heartbeat.c @@ -47,9 +47,9 @@ typedef struct hb_server_t { const char *ip; int busy; int ready; - int seen; int port; int id; + apr_time_t seen; proxy_worker *worker; } hb_server_t; diff --git a/modules/proxy/mod_proxy_scgi.c b/modules/proxy/mod_proxy_scgi.c index 6bc0b47cbaa..1f16ae47cf4 100644 --- a/modules/proxy/mod_proxy_scgi.c +++ b/modules/proxy/mod_proxy_scgi.c @@ -246,7 +246,8 @@ static int send_headers(request_rec *r, proxy_conn_rec *conn) const char *ns_len; const apr_array_header_t *env_table; const apr_table_entry_t *env; - apr_size_t j, len, bodylen_size; + int j; + apr_size_t len, bodylen_size; apr_size_t headerlen = sizeof(CONTENT_LENGTH) + sizeof(SCGI_MAGIC) + sizeof(SCGI_PROTOCOL_VERSION); @@ -265,7 +266,7 @@ static int send_headers(request_rec *r, proxy_conn_rec *conn) */ env_table = apr_table_elts(r->subprocess_env); env = (apr_table_entry_t *)env_table->elts; - for (j=0; jnelts; ++j) { + for (j = 0; j < env_table->nelts; ++j) { if ( (!strcmp(env[j].key, GATEWAY_INTERFACE)) || (!strcmp(env[j].key, CONTENT_LENGTH)) || (!strcmp(env[j].key, SCGI_MAGIC))) { @@ -293,7 +294,7 @@ static int send_headers(request_rec *r, proxy_conn_rec *conn) memcpy(cp, SCGI_PROTOCOL_VERSION, sizeof(SCGI_PROTOCOL_VERSION)); cp += sizeof(SCGI_PROTOCOL_VERSION); - for (j=0; jnelts; ++j) { + for (j = 0; j < env_table->nelts; ++j) { if ( (!strcmp(env[j].key, GATEWAY_INTERFACE)) || (!strcmp(env[j].key, CONTENT_LENGTH)) || (!strcmp(env[j].key, SCGI_MAGIC))) { diff --git a/server/util_script.c b/server/util_script.c index 0e22943ec06..58983079de8 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -811,7 +811,9 @@ AP_DECLARE(apr_status_t) ap_body_to_table(request_rec *r, apr_table_t **table) if (!rv) { apr_size_t total; /* XXX where's our test that len fits in memory??? - * theoretically can be a large file > ram space + * theoretically can be a large file > ram space. + * need to cast len to apr_size_t but it would mask + * this notable mistake */ buffer = apr_palloc(tpool, len+1);