]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Dispatch 26 compiler emits into oblivion. Vetting is desired, please
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 20 Jan 2002 20:14:38 +0000 (20:14 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 20 Jan 2002 20:14:38 +0000 (20:14 +0000)
  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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@92949 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
src/main/http_config.c
src/main/http_protocol.c
src/main/rfc1413.c
src/main/util_uri.c
src/modules/proxy/mod_proxy.c
src/modules/proxy/proxy_connect.c
src/modules/proxy/proxy_ftp.c
src/modules/proxy/proxy_http.c
src/modules/standard/mod_include.c
src/modules/standard/mod_mime.c
src/modules/standard/mod_mime_magic.c
src/modules/standard/mod_negotiation.c
src/modules/standard/mod_rewrite.c
src/modules/standard/mod_status.c

index 795cbb972546bb6e5d4f6f457d618651d3075ae7..153997b4156e475550f691208451bd69fff537c1 100644 (file)
@@ -1566,7 +1566,9 @@ static void default_listeners(pool *p, server_rec *s)
     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;
index 62a18fe574002b6bc0306e04ffef911f02f9c319..516daa0252d3c293860e2556ecf07332697e295a 100644 (file)
@@ -1061,7 +1061,7 @@ static void get_mime_headers(request_rec *r)
     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 @@ API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy)
     }
 
     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 @@ API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
      * 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);
index 007b67a07997b407c0dd6c80ba5ceed561b9fd9c..6fd6b36ce383cb0f99f017c76025a87780e88e74 100644 (file)
@@ -161,7 +161,7 @@ static int get_rfc1413(int sock, const struct sockaddr_in *our_sin,
     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) {
index 19017a6b15bcf0a9ba7655d3dbe80a7a5d19d0bb..77c1d1f3cc68b67f64d6ac0c997fb7fcbc68b92e 100644 (file)
@@ -483,7 +483,7 @@ API_EXPORT(int) ap_parse_hostinfo_components(pool *p, const char *hostinfo,
     ++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;
         }
index d11ccbe3ad87c16d72dbe218d128557154064a09..eb1fcb1bcd8a0ae296eb825bdf01ab2658a45510 100644 (file)
@@ -441,7 +441,7 @@ static void *
     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;
index d10b84300dd6b99322d99383013b1305646c3ce5..50fae7832604e26490e7a0adbb7ceaedaa971133 100644 (file)
@@ -174,7 +174,8 @@ int ap_proxy_connect_handler(request_rec *r, cache_req *c, char *url,
             "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)
index 036ebc31bb28d05ff425f0bbf4faf77a63936844..7c38f0ae7d73b2d1cf5d73fe42eb1b45afe01312 100644 (file)
@@ -547,7 +547,7 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url)
 
     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);
index 2d339595f3dce2384fd55c11943de025c1cee8ee..1eb522b634c53630a993557282b1ee0dbb60f947 100644 (file)
@@ -219,13 +219,13 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url,
     }
 
     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);
index 83dd08f6d72f8b894f5aced543bd4a7d868903ad..6e5f979c343383841118fce638594a747e589de6 100644 (file)
@@ -455,7 +455,7 @@ static int get_directive(FILE *in, char *dest, size_t len, pool *p)
     }
     /* now get directive */
     while (1) {
-       if (d - dest == len) {
+       if (d == len + dest) {
            return 1;
        }
         *d++ = ap_tolower(c);
@@ -552,7 +552,7 @@ static void parse_string(request_rec *r, const char *in, char *out,
                    /* 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;
index c6c254fbdca1628071ed2ec50855af446cc43974..f5a4acf208a0daa4a235b9af11e5b9c23224821c 100644 (file)
@@ -392,7 +392,7 @@ static char *zap_sp(char *s)
     return (s);
 }
 
-static int is_token(char c)
+static int is_token(int c)
 {
     int res;
 
@@ -401,7 +401,7 @@ static int is_token(char c)
     return res;
 }
 
-static int is_qtext(char c)
+static int is_qtext(int c)
 {
     int res;
 
index 4fcd7e4e6c1d82d23aa60acffb77ab89e7507aa9..b6f9bd1ce83a36d0e36cdea165ccb8f8835c2386 100644 (file)
@@ -1812,7 +1812,7 @@ static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s,
 {
     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 @@ static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s,
            break;
        }
 
-       if (offset + sizeof(union VALUETYPE) > nbytes)
+       if (offset + (long)sizeof(union VALUETYPE) > nbytes)
                      return 0;
 
        memcpy(p, s + offset, sizeof(union VALUETYPE));
index 3fad90dd6f6a05c5fb2a2327acd9505d611a6577..7d9aca8387e14648ddf5a7b304853a6c8a3ea428 100644 (file)
@@ -389,10 +389,10 @@ static const char *get_entry(pool *p, accept_rec *result,
 
         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 @@ static int read_type_map(negotiation_state *neg, request_rec *rr)
                 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 @@ static void set_language_quality(negotiation_state *neg, var_rec *variant)
             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 @@ static void set_language_quality(negotiation_state *neg, var_rec *variant)
                     
                     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] == '-')) ) {
                         
index ce091f1c6cfff5c397c4e312a04d66fb4417ad57..d92b66530e5ee263e1815559c3ce0f9afab83e12 100644 (file)
@@ -2475,7 +2475,7 @@ static void reduce_uri(request_rec *r)
 
     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 @@ static int rewrite_rand(int l, int h)
      * 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)
index 79f543586ca596590790b8ff91d13363b3597611..03c28f5e5082f060e3c16e826c6b904bcc8fc52e 100644 (file)
@@ -410,12 +410,14 @@ static int status_handler(request_rec *r)
                        (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);
            }