From: Mr Dash Four <mr.dash.four@googlemail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Netfilter Core Team <netfilter-devel@vger.kernel.org>
Subject: [PATCH] libnetfilter_acct: use PRIu64 and remove unnecessary cast
Date: Tue, 05 Mar 2013 18:40:39 +0000 [thread overview]
Message-ID: <51363C27.3020305@googlemail.com> (raw)
In-Reply-To: <20130305135943.GA4369@localhost>
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@googlemail.com>
---
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);
next prev parent reply other threads:[~2013-03-05 18:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 12:47 [PATCH] nfacct: correct regressions in v1.0.1 Mr Dash Four
2013-03-05 13:59 ` Pablo Neira Ayuso
2013-03-05 18:40 ` Mr Dash Four
2013-03-05 18:40 ` Mr Dash Four [this message]
2013-03-15 11:47 ` [PATCH] libnetfilter_acct: use PRIu64 and remove unnecessary cast Pablo Neira Ayuso
2013-03-16 14:06 ` Mr Dash Four
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51363C27.3020305@googlemail.com \
--to=mr.dash.four@googlemail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).