X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=parsers.c;h=e2a70eaad2e33f7cefcc9c3e04643f868d867c2f;hb=d0f0dfa1236981fa54da94a6255f7c1cf68e5c85;hp=c24b518a78d84f3bd81ca5f39861f64bc64d3225;hpb=df060e5bb4913aa5130f01302d3228a7171a2919;p=privoxy.git diff --git a/parsers.c b/parsers.c index c24b518a..e2a70eaa 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.210 2009/12/25 11:39:26 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.213 2010/06/13 12:26:04 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -318,7 +318,7 @@ long flush_socket(jb_socket fd, struct iob *iob) jb_err add_to_iob(struct client_state *csp, char *buf, long n) { struct iob *iob = csp->iob; - size_t used, offset, need, want; + size_t used, offset, need; char *p; if (n <= 0) return JB_ERR_OK; @@ -341,7 +341,12 @@ jb_err add_to_iob(struct client_state *csp, char *buf, long n) if (need > iob->size) { - for (want = csp->iob->size ? csp->iob->size : 512; want <= need;) want *= 2; + size_t want = csp->iob->size ? csp->iob->size : 512; + + while (want <= need) + { + want *= 2; + } if (want <= csp->config->buffer_limit && NULL != (p = (char *)realloc(iob->buf, want))) { @@ -2396,7 +2401,6 @@ static jb_err server_last_modified(struct client_state *csp, char **header) #endif struct tm *timeptr = NULL; time_t now, last_modified; - long int days, hours, minutes, seconds; /* * Are we messing with the Last-Modified header? @@ -2462,6 +2466,7 @@ static jb_err server_last_modified(struct client_state *csp, char **header) long int rtime = (long int)difftime(now, last_modified); if (rtime) { + long int days, hours, minutes, seconds; const int negative_delta = (rtime < 0); if (negative_delta) @@ -3148,7 +3153,6 @@ static jb_err client_if_modified_since(struct client_state *csp, char **header) struct tm *timeptr = NULL; time_t tm = 0; const char *newval; - long int hours, minutes, seconds; char * endptr; if ( 0 == strcmpic(*header, "If-Modified-Since: Wed, 08 Jun 1955 12:00:00 GMT")) @@ -3183,6 +3187,7 @@ static jb_err client_if_modified_since(struct client_state *csp, char **header) } else { + long int hours, minutes, seconds; long int rtime = strtol(newval, &endptr, 0); const int negative_range = (rtime < 0);