You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/06/10 20:51:26 UTC
cvs commit: apache-2.0/src/modules/standard mod_include.c
trawick 00/06/10 11:51:25
Modified: src/modules/standard mod_include.c
Log:
cast ap_snprintf() argument to the type expected by the format string
(to fix gcc warning on FreeBSD)
Revision Changes Path
1.36 +1 -1 apache-2.0/src/modules/standard/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- mod_include.c 2000/06/06 21:45:15 1.35
+++ mod_include.c 2000/06/10 18:51:24 1.36
@@ -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++) {
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...
Re: cvs commit: apache-2.0/src/modules/standard mod_include.c
Posted by rb...@covalent.net.
> @@ -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 rb...@covalent.net.
> @@ -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
-------------------------------------------------------------------------------