You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@worldgate.com> on 1998/01/10 05:37:59 UTC

[PATCH] a couple of casts for msvc warnings

Index: mod_negotiation.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_negotiation.c,v
retrieving revision 1.63
diff -u -r1.63 mod_negotiation.c
--- mod_negotiation.c	1998/01/07 16:46:54	1.63
+++ mod_negotiation.c	1998/01/10 04:36:20
@@ -371,14 +371,14 @@
 
         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] == 'm' && parm[1] == 'x' &&
                  parm[2] == 'b' && parm[3] == '\0') {
-            result->max_bytes = atof(cp);
+            result->max_bytes = (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;
@@ -741,7 +741,7 @@
                 set_mime_fields(&mime_info, &accept_info);
             }
             else if (!strncmp(buffer, "content-length:", 15)) {
-                mime_info.bytes = atof(body);
+                mime_info.bytes = (float)atof(body);
             }
             else if (!strncmp(buffer, "content-language:", 17)) {
                 mime_info.content_languages = do_languages_line(neg->pool,


Re: [PATCH] a couple of casts for msvc warnings

Posted by Dean Gaudet <dg...@arctic.org>.
It'd be better to use double then, and the cast would be unnecessary and
>32 bit integers could be represented easily.

Dean

On Sat, 10 Jan 1998, Ben Laurie wrote:

> Paul Sutton wrote:
> > not
> > sure why bytes (content length) and max_bytes are floats, though.
> 
> I think so they can be > 2^32 without needing to worry about long
> longs...
> 
> Cheers,
> 
> Ben.
> 
> -- 
> Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
> Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
> and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
> A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
> London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache
> 


Re: [PATCH] a couple of casts for msvc warnings

Posted by Paul Sutton <pa...@eu.c2.net>.
On Sat, 10 Jan 1998, Ben Laurie wrote:
> Paul Sutton wrote:
> > not
> > sure why bytes (content length) and max_bytes are floats, though.
> 
> I think so they can be > 2^32 without needing to worry about long
> longs...

Sure, but if negotiation selects a variant with a filesize greater than
2^32 it is soon going to fail on sending because everywhere else uses
plain longs -- e.g. set_content_length(request_rec *r, long clength() 

//pcs


Re: [PATCH] a couple of casts for msvc warnings

Posted by Ben Laurie <be...@algroup.co.uk>.
Paul Sutton wrote:
> not
> sure why bytes (content length) and max_bytes are floats, though.

I think so they can be > 2^32 without needing to worry about long
longs...

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: [PATCH] a couple of casts for msvc warnings

Posted by Paul Sutton <pa...@eu.c2.net>.
On Fri, 9 Jan 1998, Marc Slemko wrote:
> Index: mod_negotiation.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/modules/standard/mod_negotiation.c,v
> retrieving revision 1.63
> diff -u -r1.63 mod_negotiation.c
> --- mod_negotiation.c	1998/01/07 16:46:54	1.63
> +++ mod_negotiation.c	1998/01/10 04:36:20
> @@ -371,14 +371,14 @@
>  
>          if (parm[0] == 'q'
>              && (parm[1] == '\0' || (parm[1] == 's' && parm[2] == '\0'))) {
> -            result->quality = atof(cp);
> +            result->quality  = (float)atof(cp);

+1 for this patch. It removes the warnings on Win32 builds. I'm still not
sure why bytes (content length) and max_bytes are floats, though.

//pcs