Mesa (master): ddebug: use util_snprintf() in dd_get_debug_filename_and_mkdir

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 2 07:07:18 UTC 2018


Module: Mesa
Branch: master
Commit: 1090e97e77fcde03552320b8262f14e3f0367391
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1090e97e77fcde03552320b8262f14e3f0367391

Author: Andres Gomez <agomez at igalia.com>
Date:   Wed Aug  1 16:26:48 2018 +0300

ddebug: use util_snprintf() in dd_get_debug_filename_and_mkdir

Instead of plain snprintf(). To fix the MSVC 2013 build:

  Compiling src\gallium\auxiliary\driver_ddebug\dd_draw.c ...
dd_draw.c
c:\projects\mesa\src\gallium\auxiliary\driver_ddebug\dd_util.h(60) : warning C4013: 'snprintf' undefined; assuming extern returning int

...

gallium.lib(dd_draw.obj) : error LNK2001: unresolved external symbol _snprintf
build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll : fatal error LNK1120: 1 unresolved externals
scons: *** [build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll] Error 1120
scons: building terminated because of errors.

Fixes: 6ff0c6f4ebc ("gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times")
Cc: Marek Olšák <marek.olsak at amd.com>
Cc: Brian Paul <brianp at vmware.com>
Cc: Roland Scheidegger <sroland at vmware.com>
Cc: Nicolai Hähnle <nicolai.haehnle at amd.com>
Signed-off-by: Andres Gomez <agomez at igalia.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/auxiliary/driver_ddebug/dd_util.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h b/src/gallium/auxiliary/driver_ddebug/dd_util.h
index bcf026f2ef..20aca94cc6 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_util.h
+++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h
@@ -35,6 +35,7 @@
 #include "os/os_process.h"
 #include "util/u_atomic.h"
 #include "util/u_debug.h"
+#include "util/u_string.h"
 
 #include "pipe/p_config.h"
 #if defined(PIPE_OS_UNIX)
@@ -61,13 +62,13 @@ dd_get_debug_filename_and_mkdir(char *buf, size_t buflen, bool verbose)
       strcpy(proc_name, "unknown");
    }
 
-   snprintf(dir, sizeof(dir), "%s/"DD_DIR, debug_get_option("HOME", "."));
+   util_snprintf(dir, sizeof(dir), "%s/"DD_DIR, debug_get_option("HOME", "."));
 
    if (mkdir(dir, 0774) && errno != EEXIST)
       fprintf(stderr, "dd: can't create a directory (%i)\n", errno);
 
-   snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(),
-            p_atomic_inc_return(&index) - 1);
+   util_snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(),
+                 p_atomic_inc_return(&index) - 1);
 
    if (verbose)
       fprintf(stderr, "dd: dumping to file %s\n", buf);




More information about the mesa-commit mailing list