From 4d9517f0b4092b62dc791125823d6ce581d0c26c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 5 May 2004 06:57:26 +0000 Subject: [PATCH] prevent warnings when using the gcc option -Wunreachable-code --- lib/mprintf.c | 16 +++++++++++----- lib/transfer.c | 39 ++++++++++++++++++++------------------- lib/url.c | 1 - 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/lib/mprintf.c b/lib/mprintf.c index ddf34edf8..e8613839f 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -44,6 +44,11 @@ #define SIZEOF_LONG_DOUBLE 0 #endif +#ifndef SIZEOF_SIZE_T +/* default to 4 bytes for size_t unless defined in the config.h */ +#define SIZEOF_SIZE_T 4 +#endif + #ifdef DPRINTF_DEBUG #define HAVE_LONGLONG #define LONG_LONG long long @@ -381,11 +386,12 @@ static long dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, case 'z': /* the code below generates a warning if -Wunreachable-code is used */ - if (sizeof(size_t) > sizeof(unsigned long)) - flags |= FLAGS_LONGLONG; - if (sizeof(size_t) > sizeof(unsigned int)) - flags |= FLAGS_LONG; - break; +#if SIZEOF_SIZE_T>4 + flags |= FLAGS_LONGLONG; +#else + flags |= FLAGS_LONG; +#endif + break; case 'O': #if SIZEOF_CURL_OFF_T > 4 flags |= FLAGS_LONGLONG; diff --git a/lib/transfer.c b/lib/transfer.c index ed1245fe9..5d8fd7306 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1831,35 +1831,36 @@ CURLcode Curl_follow(struct SessionHandle *data, * We get here when the HTTP code is 300-399 (and 401). We need to perform * differently based on exactly what return code there was. * - * News from 7.10.6: we can also get here on a 401, in case we act on a - * HTTP authentication scheme other than Basic. + * News from 7.10.6: we can also get here on a 401 or 407, in case we act on + * a HTTP (proxy-) authentication scheme other than Basic. */ switch(data->info.httpcode) { - case 401: - /* Act on an authentication, we keep on moving and do the Authorization: - XXXX header in the HTTP request code snippet */ - break; - case 300: /* Multiple Choices */ - case 306: /* Not used */ - case 307: /* Temporary Redirect */ - default: /* for all unknown ones */ - /* These are explicitly mention since I've checked RFC2616 and they + /* 401 - Act on a www-authentication, we keep on moving and do the + Authorization: XXXX header in the HTTP request code snippet */ + /* 407 - Act on a proxy-authentication, we keep on moving and do the + Proxy-Authorization: XXXX header in the HTTP request code snippet */ + /* 300 - Multiple Choices */ + /* 306 - Not used */ + /* 307 - Temporary Redirect */ + default: /* for all above (and the unknown ones) */ + /* Some codes are explicitly mentioned since I've checked RFC2616 and they * seem to be OK to POST to. */ break; case 301: /* Moved Permanently */ /* (quote from RFC2616, section 10.3.2): * - * Note: When automatically redirecting a POST request after - * receiving a 301 status code, some existing HTTP/1.0 user agents - * will erroneously change it into a GET request. + * Note: When automatically redirecting a POST request after receiving a + * 301 status code, some existing HTTP/1.0 user agents will erroneously + * change it into a GET request. * * ---- - * Warning: Because most of importants user agents do this clear - * RFC2616 violation, many webservers expect this misbehavior. So - * these servers often answers to a POST request with an error page. - * To be sure that libcurl gets the page that most user agents - * would get, libcurl has to force GET: + * + * Warning: Because most of importants user agents do this obvious RFC2616 + * violation, many webservers expect this misbehavior. So these servers + * often answers to a POST request with an error page. To be sure that + * libcurl gets the page that most user agents would get, libcurl has to + * force GET: */ if( data->set.httpreq == HTTPREQ_POST || data->set.httpreq == HTTPREQ_POST_FORM) { diff --git a/lib/url.c b/lib/url.c index df07f538a..fdc43789b 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1810,7 +1810,6 @@ static int handleSock5Proxy(const char *proxy_name, failf(conn->data, "%s:%d has an internal error an needs to be fixed to work", __FILE__, __LINE__); - return 1; #endif }