You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "Roy T. Fielding" <fi...@ebuilt.com> on 2001/05/04 01:17:45 UTC

Re: cvs commit: apr/strings apr_snprintf.c

>   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