[Piglit] [PATCH 6/7] tests/util: Define snprintf as _snprintf on MSVC.

Emil Velikov emil.l.velikov at gmail.com
Fri Nov 7 09:55:04 PST 2014


On 07/11/14 14:21, jfonseca at vmware.com wrote:
> From: José Fonseca <jfonseca at vmware.com>
> 
> As the semantics of sprintf_s's arguments are quite different, so code
> that relies on it might misbehave.
Indeed sprintf_s has an additional argument (buffer_length) which might
cause a bit of an issue.

On a slightly related note, I've used _vsnprintf_s/_vscprintf in waffle
to implement snprintf, yet I'm not sure if it brings anything special
wrt _snprintf.

Any ideas ?

-Emil
> ---
>  tests/util/piglit-util.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
> index 0238b7f..84e2066 100755
> --- a/tests/util/piglit-util.h
> +++ b/tests/util/piglit-util.h
> @@ -58,7 +58,7 @@ extern "C" {
>  #define inline __inline
>  #endif
>  
> -#define snprintf sprintf_s
> +#define snprintf _snprintf
>  
>  #endif /* defined(_MSC_VER) */
>  
> 



More information about the Piglit mailing list