]> granicus.if.org Git - apache/commitdiff
Toss the float nonsense from c-l, and cast atof as a (float), which I
authorWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 10 Apr 2001 20:28:01 +0000 (20:28 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 10 Apr 2001 20:28:01 +0000 (20:28 +0000)
  will argue is a totally appropriate use of a cast :-)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88794 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/mappers/mod_negotiation.c

diff --git a/CHANGES b/CHANGES
index 1d40adf633e2d61a948854fe283c60f6acb0f8e7..8432fb81ebbc666180572dce3391f1bcdafde616 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.17-dev
 
+  *) Fix content-length in mod_negotiation to a long int representation.
+     [William Rowe]
+
   *) Remove BindAddress from the default config file.
      [giles@nemeton.com.au]
 
index 55de2e5758154465b113033208fdd85756cf76a7..679460c0882d5eb7c1a23c44380996f1172f6428 100644 (file)
@@ -204,7 +204,7 @@ typedef struct var_rec {
 
     /* Now some special values */
     float level;                /* Auxiliary to content-type... */
-    float bytes;                /* content length, if known */
+    long  bytes;                /* content length, if known */
     int lang_index;             /* pre HTTP/1.1 language priority stuff */
     int is_pseudo_html;         /* text/html, *or* the INCLUDES_MAGIC_TYPEs */
 
@@ -266,7 +266,7 @@ static void clean_var_rec(var_rec *mime_info)
     mime_info->is_pseudo_html = 0;
     mime_info->level = 0.0f;
     mime_info->level_matched = 0.0f;
-    mime_info->bytes = 0.0f;
+    mime_info->bytes = 0;
     mime_info->lang_index = -1;
     mime_info->mime_stars = 0;
     mime_info->definite = 1;
@@ -401,10 +401,10 @@ static const char *get_entry(apr_pool_t *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;
@@ -832,7 +832,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 = atol(body);
                 has_content = 1;
             }
             else if (!strncmp(buffer, "content-language:", 17)) {
@@ -1453,7 +1453,7 @@ static void set_language_quality(negotiation_state *neg, var_rec *variant)
  * machinery.  At some point, that ought to be fixed.
  */
 
-static float find_content_length(negotiation_state *neg, var_rec *variant)
+static long find_content_length(negotiation_state *neg, var_rec *variant)
 {
     apr_finfo_t statb;
 
@@ -1463,8 +1463,7 @@ static float find_content_length(negotiation_state *neg, var_rec *variant)
 
         if (apr_stat(&statb, fullname,
                      APR_FINFO_SIZE, neg->pool) == APR_SUCCESS) {
-            /* Note, precision may be lost */
-            variant->bytes = (float) statb.size;
+            variant->bytes = statb.size;
         }
     }