You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2002/01/20 21:14:38 UTC

cvs commit: apache-1.3/src/modules/standard mod_include.c mod_mime.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c mod_status.c

wrowe       02/01/20 12:14:38

  Modified:    src/main http_config.c http_protocol.c rfc1413.c util_uri.c
               src/modules/proxy mod_proxy.c proxy_connect.c proxy_ftp.c
                        proxy_http.c
               src/modules/standard mod_include.c mod_mime.c
                        mod_mime_magic.c mod_negotiation.c mod_rewrite.c
                        mod_status.c
  Log:
    Dispatch 26 compiler emits into oblivion.  Vetting is desired, please
    post to the list if you participate.  They are all blindingly obvious,
    but extra eyes always help
  
    This eliminates all but the regex emits and MSVC's borked misdeclaration
    of FD_SET.
  
  Revision  Changes    Path
  1.162     +3 -1      apache-1.3/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_config.c,v
  retrieving revision 1.161
  retrieving revision 1.162
  diff -u -r1.161 -r1.162
  --- http_config.c	28 Dec 2001 05:03:07 -0000	1.161
  +++ http_config.c	20 Jan 2002 20:14:37 -0000	1.162
  @@ -1566,7 +1566,9 @@
       new = ap_pcalloc(p, sizeof(listen_rec));
       new->local_addr.sin_family = AF_INET;
       new->local_addr.sin_addr = ap_bind_address;
  -    new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT);
  +    /* Buck ugly cast to get around terniary op bug in some (MS) compilers */
  +    new->local_addr.sin_port = htons((unsigned short)(s->port ? s->port 
  +                                                        : DEFAULT_HTTP_PORT));
       new->fd = -1;
       new->used = 0;
       new->next = NULL;
  
  
  
  1.309     +5 -3      apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.308
  retrieving revision 1.309
  diff -u -r1.308 -r1.309
  --- http_protocol.c	20 Jan 2002 19:19:10 -0000	1.308
  +++ http_protocol.c	20 Jan 2002 20:14:37 -0000	1.309
  @@ -1061,7 +1061,7 @@
       char *value;
       char *copy;
       int len;
  -    unsigned int fields_read = 0;
  +    int fields_read = 0;
       table *tmp_headers;
   
       /* We'll use ap_overlap_tables later to merge these into r->headers_in. */
  @@ -1968,7 +1968,8 @@
       }
   
       max_body = ap_get_limit_req_body(r);
  -    if (max_body && (r->remaining > max_body)) {
  +    if (max_body && ((unsigned long)r->remaining > max_body)
  +                 && (r->remaining >= 0)) {
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
             "Request content-length of %s is larger than the configured "
             "limit of %lu", lenp, max_body);
  @@ -2076,7 +2077,8 @@
        * length requests and nobody cares if it goes over by one buffer.
        */
       max_body = ap_get_limit_req_body(r);
  -    if (max_body && (r->read_length > max_body)) {
  +    if (max_body && ((unsigned long) r->read_length > max_body)
  +                 && (r->read_length >= 0)) {
           ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
               "Chunked request body is larger than the configured limit of %lu",
               max_body);
  
  
  
  1.38      +1 -1      apache-1.3/src/main/rfc1413.c
  
  Index: rfc1413.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/rfc1413.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- rfc1413.c	28 Dec 2001 05:03:07 -0000	1.37
  +++ rfc1413.c	20 Jan 2002 20:14:37 -0000	1.38
  @@ -161,7 +161,7 @@
       ebcdic2ascii(buffer, buffer, buflen);
   #endif
       i = 0;
  -    while(i < strlen(buffer)) {
  +    while(i < (int)strlen(buffer)) {
           int j;
   	j = write(sock, buffer+i, (strlen(buffer+i)));
   	if (j < 0 && errno != EINTR) {
  
  
  
  1.37      +1 -1      apache-1.3/src/main/util_uri.c
  
  Index: util_uri.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/util_uri.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- util_uri.c	23 Aug 2001 06:38:25 -0000	1.36
  +++ util_uri.c	20 Jan 2002 20:14:37 -0000	1.37
  @@ -483,7 +483,7 @@
       ++s;
       uptr->port_str = ap_pstrdup(p, s);
       if (*s != '\0') {
  -        uptr->port = strtol(uptr->port_str, &endstr, 10);
  +        uptr->port = (unsigned short)strtol(uptr->port_str, &endstr, 10);
           if (*endstr == '\0') {
               return HTTP_OK;
           }
  
  
  
  1.78      +1 -1      apache-1.3/src/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- mod_proxy.c	18 Jan 2002 21:59:21 -0000	1.77
  +++ mod_proxy.c	20 Jan 2002 20:14:37 -0000	1.78
  @@ -441,7 +441,7 @@
       ps->cache.dirlevels_set = 0;
       ps->cache.dirlength = 1;
       ps->cache.dirlength_set = 0;
  -    ps->cache.cache_completion = DEFAULT_CACHE_COMPLETION;
  +    ps->cache.cache_completion = (float)DEFAULT_CACHE_COMPLETION;
       ps->cache.cache_completion_set = 0;
   
       return ps;
  
  
  
  1.47      +2 -1      apache-1.3/src/modules/proxy/proxy_connect.c
  
  Index: proxy_connect.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_connect.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- proxy_connect.c	18 Jan 2002 20:26:58 -0000	1.46
  +++ proxy_connect.c	20 Jan 2002 20:14:37 -0000	1.47
  @@ -174,7 +174,8 @@
               "CONNECT to %s on port %d", host, port);
       }
   
  -    server.sin_port = (proxyport ? htons(proxyport) : htons(port));
  +    /* Nasty cast to work around broken terniary expressions on MSVC */
  +    server.sin_port = htons((unsigned short)(proxyport ? proxyport : port));
       err = ap_proxy_host2addr(proxyhost ? proxyhost : host, &server_hp);
   
       if (err != NULL)
  
  
  
  1.90      +1 -1      apache-1.3/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- proxy_ftp.c	18 Jan 2002 20:26:58 -0000	1.89
  +++ proxy_ftp.c	20 Jan 2002 20:14:37 -0000	1.90
  @@ -547,7 +547,7 @@
   
       memset(&server, 0, sizeof(struct sockaddr_in));
       server.sin_family = AF_INET;
  -    server.sin_port = htons(port);
  +    server.sin_port = htons((unsigned short)port);
       err = ap_proxy_host2addr(host, &server_hp);
       if (err != NULL)
           return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err);
  
  
  
  1.81      +2 -2      apache-1.3/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- proxy_http.c	18 Jan 2002 20:26:58 -0000	1.80
  +++ proxy_http.c	20 Jan 2002 20:14:37 -0000	1.81
  @@ -219,13 +219,13 @@
       }
   
       if (proxyhost != NULL) {
  -        server.sin_port = htons(proxyport);
  +        server.sin_port = htons((unsigned short)proxyport);
           err = ap_proxy_host2addr(proxyhost, &server_hp);
           if (err != NULL)
               return DECLINED;    /* try another */
       }
       else {
  -        server.sin_port = htons(destport);
  +        server.sin_port = htons((unsigned short)destport);
           err = ap_proxy_host2addr(desthost, &server_hp);
           if (err != NULL)
               return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR, err);
  
  
  
  1.131     +2 -2      apache-1.3/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_include.c,v
  retrieving revision 1.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- mod_include.c	21 Sep 2001 03:51:54 -0000	1.130
  +++ mod_include.c	20 Jan 2002 20:14:37 -0000	1.131
  @@ -455,7 +455,7 @@
       }
       /* now get directive */
       while (1) {
  -	if (d - dest == len) {
  +	if (d == len + dest) {
   	    return 1;
   	}
           *d++ = ap_tolower(c);
  @@ -552,7 +552,7 @@
   		    /* zero-length variable name causes just the $ to be copied */
   		    l = 1;
   		}
  -		l = (l > end_out - next) ? (end_out - next) : l;
  +		l = (l + next > end_out) ? (end_out - next) : l;
   		memcpy(next, expansion, l);
   		next += l;
                   break;
  
  
  
  1.61      +2 -2      apache-1.3/src/modules/standard/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- mod_mime.c	2 Oct 2001 21:01:31 -0000	1.60
  +++ mod_mime.c	20 Jan 2002 20:14:37 -0000	1.61
  @@ -392,7 +392,7 @@
       return (s);
   }
   
  -static int is_token(char c)
  +static int is_token(int c)
   {
       int res;
   
  @@ -401,7 +401,7 @@
       return res;
   }
   
  -static int is_qtext(char c)
  +static int is_qtext(int c)
   {
       int res;
   
  
  
  
  1.46      +2 -2      apache-1.3/src/modules/standard/mod_mime_magic.c
  
  Index: mod_mime_magic.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_mime_magic.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- mod_mime_magic.c	4 Oct 2001 05:55:01 -0000	1.45
  +++ mod_mime_magic.c	20 Jan 2002 20:14:38 -0000	1.46
  @@ -1812,7 +1812,7 @@
   {
       long offset = m->offset;
   
  -    if (offset + sizeof(union VALUETYPE) > nbytes)
  +    if (offset + (long)sizeof(union VALUETYPE) > nbytes)
   	          return 0;
   
       memcpy(p, s + offset, sizeof(union VALUETYPE));
  @@ -1834,7 +1834,7 @@
   	    break;
   	}
   
  -	if (offset + sizeof(union VALUETYPE) > nbytes)
  +	if (offset + (long)sizeof(union VALUETYPE) > nbytes)
   	              return 0;
   
   	memcpy(p, s + offset, sizeof(union VALUETYPE));
  
  
  
  1.111     +5 -5      apache-1.3/src/modules/standard/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_negotiation.c,v
  retrieving revision 1.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- mod_negotiation.c	18 Dec 2001 15:09:47 -0000	1.110
  +++ mod_negotiation.c	20 Jan 2002 20:14:38 -0000	1.111
  @@ -389,10 +389,10 @@
   
           if (parm[0] == 'q'
               && (parm[1] == '\0' || (parm[1] == 's' && parm[2] == '\0'))) {
  -            result->quality = atof(cp);
  +            result->quality = (float)atof(cp);
           }
           else if (parm[0] == 'l' && !strcmp(&parm[1], "evel")) {
  -            result->level = atof(cp);
  +            result->level = (float)atof(cp);
           }
           else if (!strcmp(parm, "charset")) {
               result->charset = cp;
  @@ -817,7 +817,7 @@
                   has_content = 1;
               }
               else if (!strncmp(buffer, "content-length:", 15)) {
  -                mime_info.bytes = atof(body);
  +                mime_info.bytes = (float)atof(body);
                   has_content = 1;
               }
               else if (!strncmp(buffer, "content-language:", 17)) {
  @@ -1373,7 +1373,7 @@
               float fiddle_q = 0.0f;
               int any_match_on_star = 0;
               int i, j, alen, longest_lang_range_len;
  -            
  +
               for (j = 0; j < variant->content_languages->nelts; ++j) {
                   p = NULL;
                   bestthistag = NULL;
  @@ -1416,7 +1416,7 @@
                       
                       alen = strlen(accs[i].name);
                       
  -                    if ((strlen(lang) >= alen) &&
  +                    if (((int)strlen(lang) >= alen) &&
                           !strncmp(lang, accs[i].name, alen) &&
                           ((lang[alen] == 0) || (lang[alen] == '-')) ) {
                           
  
  
  
  1.173     +2 -2      apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.172
  retrieving revision 1.173
  diff -u -r1.172 -r1.173
  --- mod_rewrite.c	30 May 2001 07:41:02 -0000	1.172
  +++ mod_rewrite.c	20 Jan 2002 20:14:38 -0000	1.173
  @@ -2475,7 +2475,7 @@
   
       cp = ap_http_method(r);
       l  = strlen(cp);
  -    if (   strlen(r->filename) > l+3 
  +    if (   (int)strlen(r->filename) > l+3 
           && strncasecmp(r->filename, cp, l) == 0
           && r->filename[l]   == ':'
           && r->filename[l+1] == '/'
  @@ -3013,7 +3013,7 @@
        * result. Doing an integer modulus would only use the lower-order bits
        * which may not be as uniformly random.
        */
  -    return ((double)(rand() % RAND_MAX) / RAND_MAX) * (h - l + 1) + l;
  +    return (int)((double)(rand() % RAND_MAX) / RAND_MAX) * (h - l + 1) + l;
   }
   
   static char *select_random_value_part(request_rec *r, char *value)
  
  
  
  1.121     +4 -2      apache-1.3/src/modules/standard/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_status.c,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- mod_status.c	9 Mar 2001 10:10:35 -0000	1.120
  +++ mod_status.c	20 Jan 2002 20:14:38 -0000	1.121
  @@ -410,12 +410,14 @@
   			(float) count / (float) up_time);
   
   	    if (up_time > 0) {
  -		format_byte_out(r, KBYTE * (float) kbcount / (float) up_time);
  +		format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount 
  +                                                          / (float) up_time));
   		ap_rputs("/second - ", r);
   	    }
   
   	    if (count > 0) {
  -		format_byte_out(r, KBYTE * (float) kbcount / (float) count);
  +		format_byte_out(r, (unsigned long) (KBYTE * (float) kbcount 
  +                                                          / (float) count));
   		ap_rputs("/request", r);
   	    }