Mesa (8.0): egl-static: fix printf warning

Dylan Noblesmith nobled at kemper.freedesktop.org
Sun Apr 29 11:25:20 UTC 2012


Module: Mesa
Branch: 8.0
Commit: e995b41a16a164426a8dfb78945802f1ea1ed997
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e995b41a16a164426a8dfb78945802f1ea1ed997

Author: Dylan Noblesmith <nobled at dreamwidth.org>
Date:   Sun Apr  1 19:57:57 2012 +0000

egl-static: fix printf warning

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.

Reviewed-by: Brian Paul <brianp at vmware.com>
(cherry picked from commit 2bb91274e2cc2290ce8e790335f1e57b81d9d783)

---

 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..67e3c29 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);




More information about the mesa-commit mailing list