1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -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
#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;

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
* 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) {

View File

@ -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
}