[Mesa-dev] [PATCH 9/9] egl-static: fix printf warning

Brian Paul brianp at vmware.com
Mon Apr 2 07:45:42 PDT 2012


On 04/01/2012 04:25 PM, nobled wrote:
> Noticed by clang:
>
> egl_st.c:57:50: warning: field precision should have type 'int',
> but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
>        ret = util_snprintf(path, sizeof(path), "%.*s/%s" UTIL_DL_EXT,
>                                                 ~~^~
>
> NOTE: This is a candidate for the 8.0 branch.
> ---
>   src/gallium/targets/egl-static/egl_st.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/gallium/targets/egl-static/egl_st.c
> b/src/gallium/targets/egl-static/egl_st.c
> index 81d7bb4..fddb809 100644
> --- a/src/gallium/targets/egl-static/egl_st.c
> +++ b/src/gallium/targets/egl-static/egl_st.c
> @@ -54,8 +54,9 @@ dlopen_gl_lib_cb(const char *dir, size_t len, void
> *callback_data)
>      int ret;
>
>      if (len) {
> +      assert(len<= INT_MAX&&  "path is insanely long!");
>         ret = util_snprintf(path, sizeof(path), "%.*s/%s" UTIL_DL_EXT,
> -            len, dir, name);
> +            (int)len, dir, name);
>      }
>      else {
>         ret = util_snprintf(path, sizeof(path), "%s" UTIL_DL_EXT, name);

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list