[PATCH] xfrm: use the right specifier for uint64_t

Cong Wang xiyou.wangcong at gmail.com
Mon Jul 21 10:44:45 PDT 2014


This fixes compile warnings like this:

xfrm/sp.c: In function 'xfrm_sp_dump_line':
xfrm/sp.c:346:3: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t' [-Wformat=]
   sprintf (dir, "%llu", sp->lft->soft_byte_limit);

Cc: Thomas Haller <thaller at redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
---
 lib/xfrm/sa.c | 8 ++++----
 lib/xfrm/sp.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c
index 38c06fc..dc887a0 100644
--- a/lib/xfrm/sa.c
+++ b/lib/xfrm/sa.c
@@ -409,20 +409,20 @@ static void xfrm_sa_dump_line(struct nl_object *a, struct nl_dump_params *p)
 	if (sa->lft->soft_byte_limit == XFRM_INF)
 		sprintf (flags, "INF");
 	else
-		sprintf (flags, "%llu", sa->lft->soft_byte_limit);
+		sprintf (flags, "%" PRIu64, sa->lft->soft_byte_limit);
 	if (sa->lft->soft_packet_limit == XFRM_INF)
 		sprintf (mode, "INF");
 	else
-		sprintf (mode, "%llu", sa->lft->soft_packet_limit);
+		sprintf (mode, "%" PRIu64, sa->lft->soft_packet_limit);
 	nl_dump_line(p, "\t\tsoft limit: %s (bytes), %s (packets)\n", flags, mode);
 	if (sa->lft->hard_byte_limit == XFRM_INF)
 		sprintf (flags, "INF");
 	else
-		sprintf (flags, "%llu", sa->lft->hard_byte_limit);
+		sprintf (flags, "%" PRIu64, sa->lft->hard_byte_limit);
 	if (sa->lft->hard_packet_limit == XFRM_INF)
 		sprintf (mode, "INF");
 	else
-		sprintf (mode, "%llu", sa->lft->hard_packet_limit);
+		sprintf (mode, "%" PRIu64, sa->lft->hard_packet_limit);
 	nl_dump_line(p, "\t\thard limit: %s (bytes), %s (packets)\n", flags, mode);
 	nl_dump_line(p, "\t\tsoft add_time: %llu (seconds), soft use_time: %llu (seconds) \n",
 	             sa->lft->soft_add_expires_seconds, sa->lft->soft_use_expires_seconds);
diff --git a/lib/xfrm/sp.c b/lib/xfrm/sp.c
index d857502..e66924b 100644
--- a/lib/xfrm/sp.c
+++ b/lib/xfrm/sp.c
@@ -343,19 +343,19 @@ static void xfrm_sp_dump_line(struct nl_object *a, struct nl_dump_params *p)
 	if (sp->lft->soft_byte_limit == XFRM_INF)
 		sprintf (dir, "INF");
 	else
-		sprintf (dir, "%llu", sp->lft->soft_byte_limit);
+		sprintf (dir, "%" PRIu64, sp->lft->soft_byte_limit);
 	if (sp->lft->soft_packet_limit == XFRM_INF)
 		sprintf (action, "INF");
 	else
-		sprintf (action, "%llu", sp->lft->soft_packet_limit);
+		sprintf (action, "%" PRIu64, sp->lft->soft_packet_limit);
 	if (sp->lft->hard_byte_limit == XFRM_INF)
 		sprintf (flags, "INF");
 	else
-		sprintf (flags, "%llu", sp->lft->hard_byte_limit);
+		sprintf (flags, "%" PRIu64, sp->lft->hard_byte_limit);
 	if (sp->lft->hard_packet_limit == XFRM_INF)
 		sprintf (share, "INF");
 	else
-		sprintf (share, "%llu", sp->lft->hard_packet_limit);
+		sprintf (share, "%" PRIu64, sp->lft->hard_packet_limit);
 	nl_dump_line(p, "\t\tsoft limit: %s (bytes), %s (packets) \n", dir, action);
 	nl_dump_line(p, "\t\thard limit: %s (bytes), %s (packets) \n", flags, share);
 	nl_dump_line(p, "\t\tsoft add_time: %llu (seconds), soft use_time: %llu (seconds) \n",
-- 
1.8.3.1




More information about the libnl mailing list