apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@ebuilt.com>
Subject Re: cvs commit: apr/strings apr_snprintf.c
Date Thu, 03 May 2001 23:17:45 GMT
>   diff -u -r1.14 -r1.15
>   --- apr_snprintf.c	2001/04/27 18:36:06	1.14
>   +++ apr_snprintf.c	2001/05/03 16:51:05	1.15
>   @@ -807,7 +807,13 @@
>    	    /*
>    	     * Modifier check
>    	     */
>   -	    if (*fmt == 'q') {
>   +            if (strncmp(fmt, APR_INT64_T_FMT, 
>   +                             sizeof(APR_INT64_T_FMT) - 2) == 0) {
>   +                /* Need to account for trailing 'd' and null in sizeof() */
>   +		var_type = IS_QUAD;
>   +		fmt += (sizeof(APR_INT64_T_FMT) - 2);
>   +            }
>   +	    else if (*fmt == 'q') {
>    		var_type = IS_QUAD;
>    		fmt++;
>    	    }

This doesn't look right.  APR_INT64_T_FMT may be someting other than qd
or lld on some platforms.  Specifically, it will be ld on platforms where
a normal long happens to be 64 bits.  So this if statement will be picked
up at possibly unusual times.  I'm not sure if anything bad would result,
but it is weird.

Why not just add all of the known format names to apr_snprintf?

....Roy


Mime
View raw message