From: Fabian Keil Date: Fri, 29 Dec 2006 19:08:22 +0000 (+0000) Subject: Reverted parts of my last commit X-Git-Tag: v_3_0_7~414 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=4de8a1b332008457fc074903db5f21cc7c00ad00 Reverted parts of my last commit to keep error handling working. --- diff --git a/jcc.c b/jcc.c index d65b6e17..415c2c05 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.114 2006/12/27 18:52:02 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.115 2006/12/29 17:38:57 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.114 2006/12/27 18:52:02 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.115 2006/12/29 17:38:57 fabiankeil + * Fixed gcc43 conversion warnings. + * * Revision 1.114 2006/12/27 18:52:02 fabiankeil * Fix -pedantic ISO C warning about converting * from function pointer to object pointer. @@ -1020,7 +1023,7 @@ static void chat(struct client_state *csp) int max_forwarded_connect_retries = csp->config->forwarded_connect_retries; const struct forward_spec * fwd; struct http_request *http; - size_t len; /* for buffer sizes */ + int len; /* for buffer sizes (and negative error codes) */ #ifdef FEATURE_KILL_POPUPS int block_popups; /* bool, 1==will block popups */ int block_popups_now = 0; /* bool, 1==currently blocking popups */ @@ -1728,7 +1731,7 @@ static void chat(struct client_state *csp) * Let's pretend the server just sent us a blank line. */ snprintf(buf, sizeof(buf), "\r\n"); - len = strlen(buf); + len = (int)strlen(buf); /* * Now, let the normal header parsing algorithm below do its @@ -1782,7 +1785,7 @@ static void chat(struct client_state *csp) if (write_socket(csp->cfd, hdr, hdrlen) || ((flushed = flush_socket(csp->cfd, csp)) < 0) - || (write_socket(csp->cfd, buf, len))) + || (write_socket(csp->cfd, buf, (size_t)len))) { log_error(LOG_LEVEL_CONNECT, "Flush header and buffers to client failed: %E"); @@ -1790,7 +1793,7 @@ static void chat(struct client_state *csp) return; } - byte_count += hdrlen + (size_t)flushed + len; + byte_count += hdrlen + (size_t)(flushed + len); freez(hdr); content_filter = NULL; server_body = 1; @@ -1799,13 +1802,13 @@ static void chat(struct client_state *csp) } else { - if (write_socket(csp->cfd, buf, len)) + if (write_socket(csp->cfd, buf, (size_t)len)) { log_error(LOG_LEVEL_ERROR, "write to client failed: %E"); return; } } - byte_count += len; + byte_count += (size_t)len; continue; } else @@ -1941,7 +1944,7 @@ static void chat(struct client_state *csp) */ if (write_socket(csp->cfd, hdr, strlen(hdr)) - || ((len = (size_t)flush_socket(csp->cfd, csp)) < 0)) + || ((len = flush_socket(csp->cfd, csp)) < 0)) { log_error(LOG_LEVEL_CONNECT, "write header to client failed: %E"); @@ -1953,7 +1956,7 @@ static void chat(struct client_state *csp) return; } - byte_count += len; + byte_count += (size_t)len; } /* we're finished with the server's header */ diff --git a/parsers.c b/parsers.c index 9060ea1e..77120cd7 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.78 2006/12/26 17:19:20 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.79 2006/12/29 18:04:40 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -45,6 +45,9 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.78 2006/12/26 17:19:20 fabiankeil * * Revisions : * $Log: parsers.c,v $ + * Revision 1.79 2006/12/29 18:04:40 fabiankeil + * Fixed gcc43 conversion warnings. + * * Revision 1.78 2006/12/26 17:19:20 fabiankeil * Bringing back the "useless" localtime() call * I removed in revision 1.67. On some platforms @@ -716,7 +719,7 @@ int flush_socket(jb_socket fd, struct client_state *csp) * or buffer limit reached. * *********************************************************************/ -jb_err add_to_iob(struct client_state *csp, char *buf, size_t n) +jb_err add_to_iob(struct client_state *csp, char *buf, int n) { struct iob *iob = csp->iob; size_t used, offset, need, want; @@ -726,7 +729,7 @@ jb_err add_to_iob(struct client_state *csp, char *buf, size_t n) used = (size_t)(iob->eod - iob->buf); offset = (size_t)(iob->cur - iob->buf); - need = used + n + 1; + need = used + (size_t)n + 1; /* * If the buffer can't hold the new data, extend it first. diff --git a/parsers.h b/parsers.h index 64a7eb92..0fface19 100644 --- a/parsers.h +++ b/parsers.h @@ -1,6 +1,6 @@ #ifndef PARSERS_H_INCLUDED #define PARSERS_H_INCLUDED -#define PARSERS_H_VERSION "$Id: parsers.h,v 1.32 2006/12/06 19:14:23 fabiankeil Exp $" +#define PARSERS_H_VERSION "$Id: parsers.h,v 1.33 2006/12/29 18:04:40 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.h,v $ @@ -43,6 +43,9 @@ * * Revisions : * $Log: parsers.h,v $ + * Revision 1.33 2006/12/29 18:04:40 fabiankeil + * Fixed gcc43 conversion warnings. + * * Revision 1.32 2006/12/06 19:14:23 fabiankeil * Added prototype for get_destination_from_headers(). * @@ -226,7 +229,7 @@ extern const add_header_func_ptr add_client_headers[]; extern const add_header_func_ptr add_server_headers[]; extern int flush_socket(jb_socket fd, struct client_state *csp); -extern jb_err add_to_iob(struct client_state *csp, char *buf, size_t n); +extern jb_err add_to_iob(struct client_state *csp, char *buf, int n); extern char *get_header(struct client_state *csp); extern char *get_header_value(const struct list *header_list, const char *header_name); extern char *sed(const struct parsers pats[], const add_header_func_ptr more_headers[], struct client_state *csp);