You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by rb...@covalent.net on 2000/06/10 21:07:45 UTC

Re: cvs commit: apache-2.0/src/modules/standard mod_include.c

>   @@ -1196,7 +1196,7 @@
>    #if defined(AP_OFF_T_IS_QUAD)
>                        ap_snprintf(tag, sizeof(tag), "%qd", finfo.size);
>    #else
>   -                    ap_snprintf(tag, sizeof(tag), "%ld", finfo.size);
>   +                    ap_snprintf(tag, sizeof(tag), "%ld", (long)finfo.size);
>    #endif
>                        l = strlen(tag);    /* grrr */
>                        for (x = 0; x < l; x++) {

I dislike this.  Apache in general doesn't use casts, because they mask
real problems.  APR provides an easy MACRO APR_OFF_T_FMT that will fix
this problem correctly without requiring a cast.  I think we should be
using it.

Ryan
_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/modules/standard mod_include.c

Posted by Jeff Trawick <tr...@bellsouth.net>.
> From: rbb@covalent.net
> Date: Sat, 10 Jun 2000 12:07:45 -0700 (PDT)
> 
> >   @@ -1196,7 +1196,7 @@
> >    #if defined(AP_OFF_T_IS_QUAD)
> >                        ap_snprintf(tag, sizeof(tag), "%qd", finfo.size);
> >    #else
> >   -                    ap_snprintf(tag, sizeof(tag), "%ld", finfo.size);
> >   +                    ap_snprintf(tag, sizeof(tag), "%ld", (long)finfo.size);
> >    #endif
> >                        l = strlen(tag);    /* grrr */
> >                        for (x = 0; x < l; x++) {
> 
> I dislike this.  Apache in general doesn't use casts, because they mask
> real problems.  APR provides an easy MACRO APR_OFF_T_FMT that will fix
> this problem correctly without requiring a cast.  I think we should be
> using it.

Actually, APR_OFF_T_FMT is broken; gcc distinguishes between int and
long int when checking such parms, but the configuration check for
APR_OFF_T_FMT doesn't distinguish between int and long int because the
sizes are the same.

I'll leave it as-is for now.  It is safe shouldn't generate warnings
either.


-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Re: cvs commit: apache-2.0/src/modules/standard mod_include.c

Posted by Jeff Trawick <tr...@bellsouth.net>.
> From: rbb@covalent.net
> Date: Sat, 10 Jun 2000 12:07:45 -0700 (PDT)
> 
> >   @@ -1196,7 +1196,7 @@
> >    #if defined(AP_OFF_T_IS_QUAD)
> >                        ap_snprintf(tag, sizeof(tag), "%qd", finfo.size);
> >    #else
> >   -                    ap_snprintf(tag, sizeof(tag), "%ld", finfo.size);
> >   +                    ap_snprintf(tag, sizeof(tag), "%ld", (long)finfo.size);
> >    #endif
> >                        l = strlen(tag);    /* grrr */
> >                        for (x = 0; x < l; x++) {
> 
> I dislike this.  Apache in general doesn't use casts, because they mask
> real problems.  APR provides an easy MACRO APR_OFF_T_FMT that will fix
> this problem correctly without requiring a cast.  I think we should be
> using it.

I would have used it if I knew it existed :)  I'll change the code to
use it.


-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...