mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Various code cleanup to avoid compiler, cppcheck, or clang warnings:
modules/debugging/mod_firehose.c: Make some internal functions static (to do: logs_cleanup() is unused) modules/filters/mod_charset_lite.c: Remove dead assignments modules/filters/mod_include.c: likewise modules/metadata/mod_usertrack.c: likewise modules/proxy/mod_proxy_ftp.c: likewise modules/ssl/ssl_engine_pphrase.c: likewise modules/proxy/mod_proxy_balancer.c: likewise; Remove NULL check that can never happen modules/proxy/proxy_util.c: Axe NULL-check that can never happen and if it would, it would just mask another bug os/unix/unixd.c: likewise modules/http/http_filters.c: Remove sub-condition that is always true modules/lua/mod_lua.c: Add default cases to switch statements modules/generators/mod_autoindex.c: Unsigned value can never be < 0 server/util_expr_eval.c: Fix compiler warnings with VC and on OS2 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1220493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -104,21 +104,21 @@ typedef struct firehose_ctx_t
|
|||||||
#define BODY_LEN (PIPE_BUF - HEADER_LEN - 2)
|
#define BODY_LEN (PIPE_BUF - HEADER_LEN - 2)
|
||||||
#define HEADER_FMT "%" APR_UINT64_T_HEX_FMT " %" APR_UINT64_T_HEX_FMT " %c %s %" APR_UINT64_T_HEX_FMT CRLF
|
#define HEADER_FMT "%" APR_UINT64_T_HEX_FMT " %" APR_UINT64_T_HEX_FMT " %c %s %" APR_UINT64_T_HEX_FMT CRLF
|
||||||
|
|
||||||
apr_status_t logs_cleanup(void *dummy)
|
static apr_status_t logs_cleanup(void *dummy)
|
||||||
{
|
{
|
||||||
apr_file_t *file = (apr_file_t *) dummy;
|
apr_file_t *file = (apr_file_t *) dummy;
|
||||||
apr_file_close(file);
|
apr_file_close(file);
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
apr_status_t filter_output_cleanup(void *dummy)
|
static apr_status_t filter_output_cleanup(void *dummy)
|
||||||
{
|
{
|
||||||
ap_filter_t *f = (ap_filter_t *) dummy;
|
ap_filter_t *f = (ap_filter_t *) dummy;
|
||||||
ap_remove_output_filter(f);
|
ap_remove_output_filter(f);
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
apr_status_t filter_input_cleanup(void *dummy)
|
static apr_status_t filter_input_cleanup(void *dummy)
|
||||||
{
|
{
|
||||||
ap_filter_t *f = (ap_filter_t *) dummy;
|
ap_filter_t *f = (ap_filter_t *) dummy;
|
||||||
ap_remove_input_filter(f);
|
ap_remove_input_filter(f);
|
||||||
@@ -128,7 +128,7 @@ apr_status_t filter_input_cleanup(void *dummy)
|
|||||||
/**
|
/**
|
||||||
* Add the terminating empty fragment to indicate end-of-connection.
|
* Add the terminating empty fragment to indicate end-of-connection.
|
||||||
*/
|
*/
|
||||||
apr_status_t pumpit_cleanup(void *dummy)
|
static apr_status_t pumpit_cleanup(void *dummy)
|
||||||
{
|
{
|
||||||
firehose_ctx_t *ctx = (firehose_ctx_t *) dummy;
|
firehose_ctx_t *ctx = (firehose_ctx_t *) dummy;
|
||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
|
@@ -864,11 +864,9 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
|||||||
consumed_bucket = NULL;
|
consumed_bucket = NULL;
|
||||||
}
|
}
|
||||||
if (dptr == APR_BRIGADE_SENTINEL(bb)) {
|
if (dptr == APR_BRIGADE_SENTINEL(bb)) {
|
||||||
done = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (APR_BUCKET_IS_EOS(dptr)) {
|
if (APR_BUCKET_IS_EOS(dptr)) {
|
||||||
done = 1;
|
|
||||||
cur_len = -1; /* XXX yuck, but that tells us to send
|
cur_len = -1; /* XXX yuck, but that tells us to send
|
||||||
* eos down; when we minimize our bb construction
|
* eos down; when we minimize our bb construction
|
||||||
* we'll fix this crap */
|
* we'll fix this crap */
|
||||||
@@ -894,7 +892,6 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
|||||||
}
|
}
|
||||||
rv = apr_bucket_read(dptr, &cur_str, &cur_len, APR_BLOCK_READ);
|
rv = apr_bucket_read(dptr, &cur_str, &cur_len, APR_BLOCK_READ);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
done = 1;
|
|
||||||
ctx->ees = EES_BUCKET_READ;
|
ctx->ees = EES_BUCKET_READ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -3809,7 +3809,6 @@ static int includes_setup(ap_filter_t *f)
|
|||||||
static apr_status_t includes_filter(ap_filter_t *f, apr_bucket_brigade *b)
|
static apr_status_t includes_filter(ap_filter_t *f, apr_bucket_brigade *b)
|
||||||
{
|
{
|
||||||
request_rec *r = f->r;
|
request_rec *r = f->r;
|
||||||
include_ctx_t *ctx = f->ctx;
|
|
||||||
request_rec *parent;
|
request_rec *parent;
|
||||||
include_dir_config *conf = ap_get_module_config(r->per_dir_config,
|
include_dir_config *conf = ap_get_module_config(r->per_dir_config,
|
||||||
&include_module);
|
&include_module);
|
||||||
@@ -3827,6 +3826,7 @@ static apr_status_t includes_filter(ap_filter_t *f, apr_bucket_brigade *b)
|
|||||||
|
|
||||||
if (!f->ctx) {
|
if (!f->ctx) {
|
||||||
struct ssi_internal_ctx *intern;
|
struct ssi_internal_ctx *intern;
|
||||||
|
include_ctx_t *ctx;
|
||||||
|
|
||||||
/* create context for this filter */
|
/* create context for this filter */
|
||||||
f->ctx = ctx = apr_palloc(r->pool, sizeof(*ctx));
|
f->ctx = ctx = apr_palloc(r->pool, sizeof(*ctx));
|
||||||
|
@@ -1209,7 +1209,7 @@ static char *find_title(request_rec *r)
|
|||||||
}
|
}
|
||||||
n = sizeof(char) * (MAX_STRING_LEN - 1);
|
n = sizeof(char) * (MAX_STRING_LEN - 1);
|
||||||
apr_file_read(thefile, titlebuf, &n);
|
apr_file_read(thefile, titlebuf, &n);
|
||||||
if (n <= 0) {
|
if (n == 0) {
|
||||||
apr_file_close(thefile);
|
apr_file_close(thefile);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -631,7 +631,7 @@ static long get_chunk_size(char *b)
|
|||||||
chunkbits -= 4;
|
chunkbits -= 4;
|
||||||
++b;
|
++b;
|
||||||
}
|
}
|
||||||
if (apr_isxdigit(*b) && (chunkbits <= 0)) {
|
if (apr_isxdigit(*b)) {
|
||||||
/* overflow */
|
/* overflow */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -131,6 +131,8 @@ static int lua_handler(request_rec *r)
|
|||||||
pool = apr_thread_pool_get(r->connection->current_thread);
|
pool = apr_thread_pool_get(r->connection->current_thread);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
default:
|
||||||
|
ap_assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
L = ap_lua_get_lua_state(pool,
|
L = ap_lua_get_lua_state(pool,
|
||||||
@@ -225,6 +227,8 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name, int ap
|
|||||||
pool = apr_thread_pool_get(r->connection->current_thread);
|
pool = apr_thread_pool_get(r->connection->current_thread);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
default:
|
||||||
|
ap_assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
L = ap_lua_get_lua_state(pool, spec);
|
L = ap_lua_get_lua_state(pool, spec);
|
||||||
|
@@ -326,7 +326,6 @@ static const char *set_cookie_exp(cmd_parms *parms, void *dummy,
|
|||||||
if (!word[0])
|
if (!word[0])
|
||||||
return "bad expires code, missing <type>";
|
return "bad expires code, missing <type>";
|
||||||
|
|
||||||
factor = 0;
|
|
||||||
if (!strncasecmp(word, "years", 1))
|
if (!strncasecmp(word, "years", 1))
|
||||||
factor = 60 * 60 * 24 * 365;
|
factor = 60 * 60 * 24 * 365;
|
||||||
else if (!strncasecmp(word, "months", 2))
|
else if (!strncasecmp(word, "months", 2))
|
||||||
|
@@ -217,7 +217,7 @@ static proxy_worker *find_route_worker(proxy_balancer *balancer,
|
|||||||
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
|
if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
|
||||||
continue;
|
continue;
|
||||||
if (*(worker->s->route) && strcmp(worker->s->route, route) == 0) {
|
if (*(worker->s->route) && strcmp(worker->s->route, route) == 0) {
|
||||||
if (worker && PROXY_WORKER_IS_USABLE(worker)) {
|
if (PROXY_WORKER_IS_USABLE(worker)) {
|
||||||
return worker;
|
return worker;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@@ -693,7 +693,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
|||||||
{
|
{
|
||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
void *sconf = s->module_config;
|
void *sconf = s->module_config;
|
||||||
proxy_server_conf *conf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module);
|
proxy_server_conf *conf;
|
||||||
ap_slotmem_instance_t *new = NULL;
|
ap_slotmem_instance_t *new = NULL;
|
||||||
apr_time_t tstamp;
|
apr_time_t tstamp;
|
||||||
|
|
||||||
|
@@ -1327,7 +1327,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
break;
|
break;
|
||||||
*strp = '\0';
|
*strp = '\0';
|
||||||
|
|
||||||
len = decodeenc(path); /* Note! This decodes a %2f -> "/" */
|
decodeenc(path); /* Note! This decodes a %2f -> "/" */
|
||||||
|
|
||||||
if (strchr(path, '/')) { /* are there now any '/' characters? */
|
if (strchr(path, '/')) { /* are there now any '/' characters? */
|
||||||
return ftp_proxyerror(r, backend, HTTP_BAD_REQUEST,
|
return ftp_proxyerror(r, backend, HTTP_BAD_REQUEST,
|
||||||
@@ -2050,7 +2050,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve the final response for the RETR or LIST commands */
|
/* Retrieve the final response for the RETR or LIST commands */
|
||||||
rc = proxy_ftp_command(NULL, r, origin, bb, &ftpmessage);
|
proxy_ftp_command(NULL, r, origin, bb, &ftpmessage);
|
||||||
apr_brigade_cleanup(bb);
|
apr_brigade_cleanup(bb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2061,8 +2061,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* finish */
|
/* finish */
|
||||||
rc = proxy_ftp_command("QUIT" CRLF,
|
proxy_ftp_command("QUIT" CRLF, r, origin, bb, &ftpmessage);
|
||||||
r, origin, bb, &ftpmessage);
|
|
||||||
/* responses: 221, 500 */
|
/* responses: 221, 500 */
|
||||||
/* 221 Service closing control connection. */
|
/* 221 Service closing control connection. */
|
||||||
/* 500 Syntax error, command unrecognized. */
|
/* 500 Syntax error, command unrecognized. */
|
||||||
|
@@ -768,7 +768,7 @@ PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *c
|
|||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"checking remote machine [%s] against [%s]",
|
"checking remote machine [%s] against [%s]",
|
||||||
uri_addr->hostname, npent[j].name);
|
uri_addr->hostname, npent[j].name);
|
||||||
if ((npent[j].name && ap_strstr_c(uri_addr->hostname, npent[j].name))
|
if (ap_strstr_c(uri_addr->hostname, npent[j].name)
|
||||||
|| npent[j].name[0] == '*') {
|
|| npent[j].name[0] == '*') {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(00916)
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(00916)
|
||||||
"connect to remote machine %s blocked: name %s "
|
"connect to remote machine %s blocked: name %s "
|
||||||
|
@@ -556,7 +556,6 @@ void ssl_pphrase_Handle(server_rec *s, apr_pool_t *p)
|
|||||||
* Let the user know when we're successful.
|
* Let the user know when we're successful.
|
||||||
*/
|
*/
|
||||||
if (nPassPhraseDialog > 0) {
|
if (nPassPhraseDialog > 0) {
|
||||||
sc = mySrvConfig(s);
|
|
||||||
if (writetty) {
|
if (writetty) {
|
||||||
apr_file_printf(writetty, "\n"
|
apr_file_printf(writetty, "\n"
|
||||||
"OK: Pass Phrase Dialog successful.\n");
|
"OK: Pass Phrase Dialog successful.\n");
|
||||||
|
@@ -165,11 +165,8 @@ static apr_status_t ap_unix_create_privileged_process(
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (args) {
|
while (args[i])
|
||||||
while (args[i]) {
|
i++;
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* allocate space for 4 new args, the input args, and a null terminator */
|
/* allocate space for 4 new args, the input args, and a null terminator */
|
||||||
newargs = apr_palloc(p, sizeof(char *) * (i + 4));
|
newargs = apr_palloc(p, sizeof(char *) * (i + 4));
|
||||||
newprogname = SUEXEC_BIN;
|
newprogname = SUEXEC_BIN;
|
||||||
|
@@ -922,6 +922,8 @@ AP_DECLARE(const char *) ap_expr_str_exec_re(request_rec *r,
|
|||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
ap_assert(0);
|
ap_assert(0);
|
||||||
|
/* Not reached */
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
AP_DECLARE(const char *) ap_expr_str_exec(request_rec *r,
|
AP_DECLARE(const char *) ap_expr_str_exec(request_rec *r,
|
||||||
@@ -1117,8 +1119,8 @@ static int op_file_min(ap_expr_eval_ctx_t *ctx, const void *data, const char *ar
|
|||||||
|
|
||||||
static int op_file_link(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg)
|
static int op_file_link(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg)
|
||||||
{
|
{
|
||||||
apr_finfo_t sb;
|
|
||||||
#if !defined(OS2)
|
#if !defined(OS2)
|
||||||
|
apr_finfo_t sb;
|
||||||
if (apr_stat(&sb, arg, APR_FINFO_MIN | APR_FINFO_LINK, ctx->p) == APR_SUCCESS
|
if (apr_stat(&sb, arg, APR_FINFO_MIN | APR_FINFO_LINK, ctx->p) == APR_SUCCESS
|
||||||
&& sb.filetype == APR_LNK) {
|
&& sb.filetype == APR_LNK) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user