From: Fabian Keil Date: Sun, 8 Mar 2009 14:19:23 +0000 (+0000) Subject: Fix justified (but harmless) compiler warnings X-Git-Tag: v_3_0_12~33 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=1c79e7655de8bcab545c9f044ac6197b233d9ec1 Fix justified (but harmless) compiler warnings on platforms where sizeof(int) < sizeof(long). --- diff --git a/actions.c b/actions.c index 967a9740..0c3cf3db 100644 --- a/actions.c +++ b/actions.c @@ -1,4 +1,4 @@ -const char actions_rcs[] = "$Id: actions.c,v 1.54 2008/09/20 10:04:33 fabiankeil Exp $"; +const char actions_rcs[] = "$Id: actions.c,v 1.55 2008/12/04 18:18:56 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/actions.c,v $ @@ -33,6 +33,9 @@ const char actions_rcs[] = "$Id: actions.c,v 1.54 2008/09/20 10:04:33 fabiankeil * * Revisions : * $Log: actions.c,v $ + * Revision 1.55 2008/12/04 18:18:56 fabiankeil + * Fix some cparser warnings. + * * Revision 1.54 2008/09/20 10:04:33 fabiankeil * Remove hide-forwarded-for-headers action which has * been obsoleted by change-x-forwarded-for{block}. @@ -1742,9 +1745,9 @@ static int load_one_actions_file(struct client_state *csp, int fileid) *********************************************************************/ char * actions_to_text(const struct action_spec *action) { - unsigned mask = action->mask; - unsigned add = action->add; - char * result = strdup(""); + unsigned long mask = action->mask; + unsigned long add = action->add; + char *result = strdup(""); struct list_entry * lst; /* sanity - prevents "-feature +feature" */ @@ -1831,9 +1834,9 @@ char * actions_to_text(const struct action_spec *action) char * actions_to_html(const struct client_state *csp, const struct action_spec *action) { - unsigned mask = action->mask; - unsigned add = action->add; - char * result = strdup(""); + unsigned long mask = action->mask; + unsigned long add = action->add; + char *result = strdup(""); struct list_entry * lst; /* sanity - prevents "-feature +feature" */ diff --git a/cgiedit.c b/cgiedit.c index b346e8ee..b1cfb024 100644 --- a/cgiedit.c +++ b/cgiedit.c @@ -1,4 +1,4 @@ -const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.63 2008/12/04 18:15:38 fabiankeil Exp $"; +const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.64 2009/03/01 18:43:09 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $ @@ -42,6 +42,9 @@ const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.63 2008/12/04 18:15:38 fabiankeil * * Revisions : * $Log: cgiedit.c,v $ + * Revision 1.64 2009/03/01 18:43:09 fabiankeil + * Fix cparser warnings. + * * Revision 1.63 2008/12/04 18:15:38 fabiankeil * Fix some cparser warnings. * @@ -4579,8 +4582,8 @@ static void javascriptify(char * identifier) static jb_err actions_to_radio(struct map * exports, const struct action_spec *action) { - unsigned mask = action->mask; - unsigned add = action->add; + unsigned long mask; + unsigned long add; int mapped_param; int checked; char current_mode; diff --git a/cgisimple.c b/cgisimple.c index 62ba94ef..3d184ec8 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,4 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.89 2008/10/11 11:31:14 fabiankeil Exp $"; +const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.90 2009/03/01 18:43:09 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -36,6 +36,9 @@ const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.89 2008/10/11 11:31:14 fabian * * Revisions : * $Log: cgisimple.c,v $ + * Revision 1.90 2009/03/01 18:43:09 fabiankeil + * Fix cparser warnings. + * * Revision 1.89 2008/10/11 11:31:14 fabiankeil * Add FEATURE_CONNECTION_KEEP_ALIVE to the list * of conditional defines on the show-status page. @@ -2225,7 +2228,7 @@ static jb_err cgi_show_file(struct client_state *csp, static jb_err load_file(const char *filename, char **buffer, size_t *length) { FILE *fp; - int ret; + long ret; jb_err err = JB_ERR_OK; fp = fopen(filename, "rb"); diff --git a/filters.c b/filters.c index 99aa5c74..18ef5b35 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.111 2008/12/04 18:13:46 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.112 2009/03/01 18:28:23 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -40,6 +40,10 @@ const char filters_rcs[] = "$Id: filters.c,v 1.111 2008/12/04 18:13:46 fabiankei * * Revisions : * $Log: filters.c,v $ + * Revision 1.112 2009/03/01 18:28:23 fabiankeil + * Help clang understand that we aren't dereferencing + * NULL pointers here. + * * Revision 1.111 2008/12/04 18:13:46 fabiankeil * Fix a cparser warning. * @@ -1791,7 +1795,7 @@ int is_untrusted_url(const struct client_state *csp) /* since this path points into a user's home space * be sure to include this spec in the trustfile. */ - int path_len = path_end - path; /* save offset */ + long path_len = path_end - path; /* save offset */ path = strdup(path); /* Copy string */ if (path != NULL) { @@ -2518,7 +2522,7 @@ const static struct forward_spec *get_forward_override_settings(struct client_st if (NULL != (socks_proxy = strchr(fwd->gateway_host, ':'))) { *socks_proxy++ = '\0'; - fwd->gateway_port = strtol(socks_proxy, NULL, 0); + fwd->gateway_port = (int)strtol(socks_proxy, NULL, 0); } if (fwd->gateway_port <= 0) @@ -2545,7 +2549,7 @@ const static struct forward_spec *get_forward_override_settings(struct client_st if (NULL != (http_parent = strchr(fwd->forward_host, ':'))) { *http_parent++ = '\0'; - fwd->forward_port = strtol(http_parent, NULL, 0); + fwd->forward_port = (int)strtol(http_parent, NULL, 0); } if (fwd->forward_port <= 0) diff --git a/jcc.c b/jcc.c index 07f97de0..9a05b306 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.229 2009/03/07 11:17:01 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.230 2009/03/07 13:09:17 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,12 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.229 2009/03/07 11:17:01 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.230 2009/03/07 13:09:17 fabiankeil + * Change csp->expected_content and_csp->expected_content_length from + * size_t to unsigned long long to reduce the likelihood of integer + * overflows that would let us close the connection prematurely. + * Bug found while investigating #2669131, reported by cyberpatrol. + * * Revision 1.229 2009/03/07 11:17:01 fabiankeil * Fix compiler warning. * @@ -3147,7 +3153,7 @@ static void chat(struct client_state *csp) * Since we have to wait for more from the server before * we can parse the headers we just continue here. */ - int header_offset = csp->iob->cur - header_start; + long header_offset = csp->iob->cur - header_start; assert(csp->iob->cur >= header_start); byte_count += (unsigned long long)(len - header_offset); log_error(LOG_LEVEL_CONNECT, "Continuing buffering headers. " @@ -3259,7 +3265,7 @@ static void chat(struct client_state *csp) * XXX: the header lenght should probably * be calculated by get_server_headers(). */ - int header_length = csp->iob->cur - header_start; + long header_length = csp->iob->cur - header_start; assert(csp->iob->cur > header_start); byte_count += (unsigned long long)(len - header_length); }