[PATCH 06/10] msvcrt: Added sprintf_p_l implementation (try2)

Alexandre Julliard julliard at winehq.org
Tue Apr 19 07:31:48 CDT 2011


Piotr Caban <piotr at codeweavers.com> writes:

> @@ -552,6 +552,74 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
>      return written;
>  }
>  
> +#ifndef PRINTF_WIDE
> +/* This functions stores sizes of arguments. It uses args[0]
> + * internally (in the following way):
> + * 0x1 - using positional parameters
> + * 0x2 - not using positional parameters
> + * 0x4 - error occurred
> + */
> +static printf_arg arg_clbk_size(void *ctx, int pos, int type, __ms_va_list *valist)
> +{
> +    static const printf_arg ret;
> +    printf_arg *args = ctx;
> +
> +    if(pos == -1) {
> +        args[0].get_int |= 1;
> +        return ret;
> +    } else
> +        args[0].get_int |= 2;
> +
> +    if(pos<1 || pos>MSVCRT__ARGMAX || (args[pos].get_int && args[pos].get_int!=type))
> +        args[0].get_int |= 4;
> +    else
> +        args[pos].get_int = type;
> +    return ret;
> +}

Using magic values like this is ugly, please add proper defines. Also
you probably want to fix the name of the function and the comments.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list