[SSSD] [PATCH] tests: Use right format string for type size_t
Lukas Slebodnik
lslebodn at redhat.com
Fri Oct 25 17:18:47 UTC 2013
ehlo,
I found few warnings in current master. (I compile with Werror)
src/tests/cmocka/test_utils.c:54:56: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
dom->name = talloc_asprintf(dom, DOMNAME_TMPL, c);
^
src/tests/cmocka/test_utils.c:57:62: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
dom->flat_name = talloc_asprintf(dom, FLATNAME_TMPL, c);
^
src/tests/cmocka/test_utils.c:60:57: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
dom->domain_id = talloc_asprintf(dom, SID_TMPL, c);
^
src/tests/cmocka/test_utils.c:111:69: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
name = talloc_asprintf(global_talloc_context, DOMNAME_TMPL, c);
^
src/tests/cmocka/test_utils.c:114:75: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
flat_name = talloc_asprintf(global_talloc_context, FLATNAME_TMPL, c);
^
src/tests/cmocka/test_utils.c:117:64: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
^
src/tests/cmocka/test_utils.c:155:69: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
name = talloc_asprintf(global_talloc_context, DOMNAME_TMPL, c);
^
src/tests/cmocka/test_utils.c:158:75: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
flat_name = talloc_asprintf(global_talloc_context, FLATNAME_TMPL, c);
^
src/tests/cmocka/test_utils.c:161:64: warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
sid = talloc_asprintf(global_talloc_context, SID_TMPL, c);
Simple patch is attached.
LS
-------------- next part --------------
>From c66b2d06490cc0235931fdc9e6bc1a5eba9f52cd Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 25 Oct 2013 19:06:15 +0200
Subject: [PATCH] tests: Use right format string for type size_t
This patch fixes few format string warnings in the file test_utils.c
src/tests/cmocka/test_utils.c:54:56:
warning: format specifies type 'unsigned int' but the
argument has type 'size_t' (aka 'unsigned long') [-Wformat]
---
src/tests/cmocka/test_utils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/tests/cmocka/test_utils.c b/src/tests/cmocka/test_utils.c
index 9152dcfa39589cd1bc1d1044ab6b755ae4b122d1..1be59ab69cfa632010c5e1700dc79f59b6f48fde 100644
--- a/src/tests/cmocka/test_utils.c
+++ b/src/tests/cmocka/test_utils.c
@@ -25,9 +25,9 @@
#include "tests/cmocka/common_mock.h"
#define DOM_COUNT 10
-#define DOMNAME_TMPL "name_%u.dom"
-#define FLATNAME_TMPL "name_%u"
-#define SID_TMPL "S-1-5-21-1-2-%u"
+#define DOMNAME_TMPL "name_%zu.dom"
+#define FLATNAME_TMPL "name_%zu"
+#define SID_TMPL "S-1-5-21-1-2-%zu"
struct dom_list_test_ctx {
size_t dom_count;
--
1.8.3.1
More information about the sssd-devel
mailing list