[PATCH] libnetfilter_acct: use PRIu64 and remove unnecessary cast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch corrects all nfacct_snprintf_* functions to use PRIu64,
given that we are using uint64_t type variables and also removes
the unnecessary casts.

Signed-off-by: Mr Dash Four <mr.dash.four@xxxxxxxxxxxxxx>
---
 src/libnetfilter_acct.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/libnetfilter_acct.c b/src/libnetfilter_acct.c
index 0abaeac..ba89e2d 100644
--- a/src/libnetfilter_acct.c
+++ b/src/libnetfilter_acct.c
@@ -13,6 +13,7 @@
 #include <endian.h>
 #include <stdlib.h>
 #include <string.h>
+#include <inttypes.h>

 #include <libmnl/libmnl.h>
 #include <linux/netfilter/nfnetlink.h>
@@ -235,10 +236,8 @@ nfacct_snprintf_plain(char *buf, size_t rem, struct nfacct *nfacct,

 	if (flags & NFACCT_SNPRINTF_F_FULL) {
 		ret = snprintf(buf, rem,
-			"{ pkts = %.20llu, bytes = %.20llu } = %s;",
-			(unsigned long long)
+			"{ pkts = %.20"PRIu64", bytes = %.20"PRIu64" } = %s;",
 			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS),
-			(unsigned long long)
 			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
 			nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME));
 	} else {
@@ -296,12 +295,10 @@ nfacct_snprintf_xml(char *buf, size_t rem, struct nfacct *nfacct,

 	ret = snprintf(buf, rem,
 			"<obj><name>%s</name>"
-			"<pkts>%.20llu</pkts>"
-			"<bytes>%.20llu</bytes>",
+			"<pkts>%.20"PRIu64"</pkts>"
+			"<bytes>%.20"PRIu64"</bytes>",
 			nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME),
-			(unsigned long long)
 			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
-			(unsigned long long)
 			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS));
 	BUFFER_SIZE(ret, size, rem, offset);



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux