From 6aaa863432967b99d0e2c87116b4ec844b90436f Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Thu, 31 Jul 2003 23:38:28 +0000 Subject: Added appropriate casts from (void*) so that the code will compile cleanly with a C++ compiler. (Tested using GCC 3.3) --- src/reqs.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/reqs.c') diff --git a/src/reqs.c b/src/reqs.c index 9a44336..b2a98de 100644 --- a/src/reqs.c +++ b/src/reqs.c @@ -1,4 +1,4 @@ -/* $Id: reqs.c,v 1.105 2003-06-26 18:19:57 rjkaes Exp $ +/* $Id: reqs.c,v 1.106 2003-07-31 23:38:28 rjkaes Exp $ * * This is where all the work in tinyproxy is actually done. Incoming * connections have a new child created for them. The child then @@ -128,7 +128,7 @@ check_allowed_connect_ports(int port) return 1; for (i = 0; i != vector_length(ports_allowed_by_connect); ++i) { - data = vector_getentry(ports_allowed_by_connect, i, NULL); + data = (int*)vector_getentry(ports_allowed_by_connect, i, NULL); if (!data) return -1; @@ -225,8 +225,8 @@ strip_username_password(char* host) static int extract_http_url(const char *url, struct request_s *request) { - request->host = safemalloc(strlen(url) + 1); - request->path = safemalloc(strlen(url) + 1); + request->host = (char*)safemalloc(strlen(url) + 1); + request->path = (char*)safemalloc(strlen(url) + 1); if (!request->host || !request->path) goto ERROR_EXIT; @@ -267,7 +267,7 @@ extract_http_url(const char *url, struct request_s *request) static int extract_ssl_url(const char *url, struct request_s *request) { - request->host = safemalloc(strlen(url) + 1); + request->host = (char*)safemalloc(strlen(url) + 1); if (!request->host) return -1; @@ -318,7 +318,8 @@ void upstream_add(const char *host, int port, const char *domain) { char *ptr; - struct upstream *up = safemalloc(sizeof (struct upstream)); + struct upstream *up = + (struct upstream*)safemalloc(sizeof (struct upstream)); if (!up) { log_message(LOG_ERR, "Unable to allocate memory in upstream_add()"); @@ -522,15 +523,15 @@ process_request(struct conn_s *connptr, hashmap_t hashofheaders) size_t request_len; /* NULL out all the fields so frees don't cause segfaults. */ - request = safecalloc(1, sizeof(struct request_s)); + request = (struct request_s*)safecalloc(1, sizeof(struct request_s)); if (!request) return NULL; request_len = strlen(connptr->request_line) + 1; - request->method = safemalloc(request_len); - url = safemalloc(request_len); - request->protocol = safemalloc(request_len); + request->method = (char*)safemalloc(request_len); + url = (char*)safemalloc(request_len); + request->protocol = (char*)safemalloc(request_len); if (!request->method || !url || !request->protocol) { safefree(url); @@ -775,7 +776,7 @@ pull_client_data(struct conn_s *connptr, long int length) char *buffer; ssize_t len; - buffer = safemalloc(min(MAXBUFFSIZE, length)); + buffer = (char*)safemalloc(min(MAXBUFFSIZE, length)); if (!buffer) return -1; @@ -1443,7 +1444,7 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request) if (connptr->connect_method) { len = strlen(request->host) + 7; - combined_string = safemalloc(len); + combined_string = (char*)safemalloc(len); if (!combined_string) { return -1; } @@ -1452,7 +1453,7 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request) request->port); } else { len = strlen(request->host) + strlen(request->path) + 14; - combined_string = safemalloc(len); + combined_string = (char*)safemalloc(len); if (!combined_string) { return -1; } -- cgit v1.2.3