From: Fabian Keil Date: Fri, 29 Dec 2006 18:30:46 +0000 (+0000) Subject: Fixed gcc43 conversion warnings, X-Git-Tag: v_3_0_7~415 X-Git-Url: http://www.privoxy.org/gitweb/appendix.html?a=commitdiff_plain;h=95a30d7f7a289d0f5261927639808e490330616c;p=privoxy.git Fixed gcc43 conversion warnings, changed sprintf calls to snprintf. --- diff --git a/filters.c b/filters.c index f29803bb..84ea1d5b 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.73 2006/12/23 16:01:02 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.74 2006/12/24 17:37:38 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -40,6 +40,10 @@ const char filters_rcs[] = "$Id: filters.c,v 1.73 2006/12/23 16:01:02 fabiankeil * * Revisions : * $Log: filters.c,v $ + * Revision 1.74 2006/12/24 17:37:38 fabiankeil + * Adjust comment in pcrs_filter_response() + * to recent pcrs changes. Hohoho. + * * Revision 1.73 2006/12/23 16:01:02 fabiankeil * Don't crash if pcre returns an error code * that pcrs didn't expect. Fixes BR 1621173. @@ -1085,7 +1089,7 @@ struct http_response *trust_url(struct client_state *csp) p = strdup(""); for (tl = csp->config->trust_list; (t = *tl) != NULL ; tl++) { - sprintf(buf, "
  • %s
  • \n", t->spec); + snprintf(buf, sizeof(buf), "
  • %s
  • \n", t->spec); string_append(&p, buf); } err = map(exports, "trusted-referrers", 1, p, 0); @@ -1107,7 +1111,7 @@ struct http_response *trust_url(struct client_state *csp) p = strdup(""); for (l = csp->config->trust_info->first; l ; l = l->next) { - sprintf(buf, "
  • %s
    \n",l->str, l->str); + snprintf(buf, sizeof(buf), "
  • %s
    \n", l->str, l->str); string_append(&p, buf); } err = map(exports, "trust-info", 1, p, 0); @@ -1684,7 +1688,7 @@ char *pcrs_filter_response(struct client_state *csp) { return(NULL); } - size = csp->iob->eod - csp->iob->cur; + size = (size_t)(csp->iob->eod - csp->iob->cur); /* * Need to check the set of re_filterfiles... @@ -1854,7 +1858,9 @@ char *gif_deanimate_response(struct client_state *csp) { struct binbuffer *in, *out; char *p; - size_t size = csp->iob->eod - csp->iob->cur; + size_t size; + + size = (size_t)(csp->iob->eod - csp->iob->cur); /* * If the body has a "chunked" transfer-encoding, @@ -1924,9 +1930,12 @@ char *gif_deanimate_response(struct client_state *csp) *********************************************************************/ char *jpeg_inspect_response(struct client_state *csp) { - struct binbuffer *in = NULL, *out = NULL; + struct binbuffer *in = NULL; + struct binbuffer *out = NULL; char *p = NULL; - size_t size = csp->iob->eod - csp->iob->cur; + size_t size; + + size = (size_t)(csp->iob->eod - csp->iob->cur); /* * If the body has a "chunked" transfer-encoding, @@ -1999,7 +2008,7 @@ char *jpeg_inspect_response(struct client_state *csp) * went wrong * *********************************************************************/ -int remove_chunked_transfer_coding(char *buffer, const size_t size) +size_t remove_chunked_transfer_coding(char *buffer, const size_t size) { size_t newsize = 0; unsigned int chunksize = 0; diff --git a/filters.h b/filters.h index 1b0cd1c9..be27370b 100644 --- a/filters.h +++ b/filters.h @@ -1,6 +1,6 @@ #ifndef FILTERS_H_INCLUDED #define FILTERS_H_INCLUDED -#define FILTERS_H_VERSION "$Id: filters.h,v 1.22 2006/07/18 14:48:46 david__schmidt Exp $" +#define FILTERS_H_VERSION "$Id: filters.h,v 1.23 2006/11/28 15:19:43 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.h,v $ @@ -39,6 +39,11 @@ * * Revisions : * $Log: filters.h,v $ + * Revision 1.23 2006/11/28 15:19:43 fabiankeil + * Implemented +redirect{s@foo@bar@} to generate + * a redirect based on a rewritten version of the + * original URL. + * * Revision 1.22 2006/07/18 14:48:46 david__schmidt * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch) * with what was really the latest development (the v_3_0_branch branch) @@ -276,7 +281,7 @@ extern const struct forward_spec *forward_url(struct http_request *http, struct extern char *pcrs_filter_response(struct client_state *csp); extern char *gif_deanimate_response(struct client_state *csp); extern char *jpeg_inspect_response(struct client_state *csp); -extern int remove_chunked_transfer_coding(char *buffer, const size_t size); +extern size_t remove_chunked_transfer_coding(char *buffer, const size_t size); extern char *execute_single_pcrs_command(char *subject, const char *pcrs_command, int *hits); extern char *rewrite_url(char *old_url, const char *pcrs_command); extern char *get_last_url(char *subject, const char *redirect_mode);