1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

prevent warnings when using the gcc option -Wunreachable-code

This commit is contained in:
Daniel Stenberg 2004-05-05 06:57:26 +00:00
parent a331aa0221
commit 4d9517f0b4
3 changed files with 31 additions and 25 deletions

View File

@ -44,6 +44,11 @@
#define SIZEOF_LONG_DOUBLE 0 #define SIZEOF_LONG_DOUBLE 0
#endif #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 #ifdef DPRINTF_DEBUG
#define HAVE_LONGLONG #define HAVE_LONGLONG
#define LONG_LONG long long #define LONG_LONG long long
@ -381,10 +386,11 @@ static long dprintf_Pass1(char *format, va_stack_t *vto, char **endpos,
case 'z': case 'z':
/* the code below generates a warning if -Wunreachable-code is /* the code below generates a warning if -Wunreachable-code is
used */ used */
if (sizeof(size_t) > sizeof(unsigned long)) #if SIZEOF_SIZE_T>4
flags |= FLAGS_LONGLONG; flags |= FLAGS_LONGLONG;
if (sizeof(size_t) > sizeof(unsigned int)) #else
flags |= FLAGS_LONG; flags |= FLAGS_LONG;
#endif
break; break;
case 'O': case 'O':
#if SIZEOF_CURL_OFF_T > 4 #if SIZEOF_CURL_OFF_T > 4

View File

@ -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 * 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. * 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 * News from 7.10.6: we can also get here on a 401 or 407, in case we act on
* HTTP authentication scheme other than Basic. * a HTTP (proxy-) authentication scheme other than Basic.
*/ */
switch(data->info.httpcode) { switch(data->info.httpcode) {
case 401: /* 401 - Act on a www-authentication, we keep on moving and do the
/* Act on an authentication, we keep on moving and do the Authorization: Authorization: XXXX header in the HTTP request code snippet */
XXXX header in the HTTP request code snippet */ /* 407 - Act on a proxy-authentication, we keep on moving and do the
break; Proxy-Authorization: XXXX header in the HTTP request code snippet */
case 300: /* Multiple Choices */ /* 300 - Multiple Choices */
case 306: /* Not used */ /* 306 - Not used */
case 307: /* Temporary Redirect */ /* 307 - Temporary Redirect */
default: /* for all unknown ones */ default: /* for all above (and the unknown ones) */
/* These are explicitly mention since I've checked RFC2616 and they /* Some codes are explicitly mentioned since I've checked RFC2616 and they
* seem to be OK to POST to. * seem to be OK to POST to.
*/ */
break; break;
case 301: /* Moved Permanently */ case 301: /* Moved Permanently */
/* (quote from RFC2616, section 10.3.2): /* (quote from RFC2616, section 10.3.2):
* *
* Note: When automatically redirecting a POST request after * Note: When automatically redirecting a POST request after receiving a
* receiving a 301 status code, some existing HTTP/1.0 user agents * 301 status code, some existing HTTP/1.0 user agents will erroneously
* will erroneously change it into a GET request. * change it into a GET request.
* *
* ---- * ----
* Warning: Because most of importants user agents do this clear *
* RFC2616 violation, many webservers expect this misbehavior. So * Warning: Because most of importants user agents do this obvious RFC2616
* these servers often answers to a POST request with an error page. * violation, many webservers expect this misbehavior. So these servers
* To be sure that libcurl gets the page that most user agents * often answers to a POST request with an error page. To be sure that
* would get, libcurl has to force GET: * libcurl gets the page that most user agents would get, libcurl has to
* force GET:
*/ */
if( data->set.httpreq == HTTPREQ_POST if( data->set.httpreq == HTTPREQ_POST
|| data->set.httpreq == HTTPREQ_POST_FORM) { || data->set.httpreq == HTTPREQ_POST_FORM) {

View File

@ -1810,7 +1810,6 @@ static int handleSock5Proxy(const char *proxy_name,
failf(conn->data, failf(conn->data,
"%s:%d has an internal error an needs to be fixed to work", "%s:%d has an internal error an needs to be fixed to work",
__FILE__, __LINE__); __FILE__, __LINE__);
return 1;
#endif #endif
} }