From: Christian Eggers <ceggers@arri.de>
To: <linux-bluetooth@vger.kernel.org>
Cc: Christian Eggers <ceggers@arri.de>
Subject: [PATCH BlueZ 2/3] monitor: fix printf format strings
Date: Fri, 23 Sep 2022 12:51:40 +0200 [thread overview]
Message-ID: <20220923105141.20176-2-ceggers@arri.de> (raw)
In-Reply-To: <20220923105141.20176-1-ceggers@arri.de>
time_t is 64 bit (long long) on many 32 bit platforms (e.g. ARM) now
---
monitor/analyze.c | 21 ++++++++++++---------
monitor/packet.c | 10 ++++++----
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/monitor/analyze.c b/monitor/analyze.c
index ac23e13bbd42..50e7e5542793 100644
--- a/monitor/analyze.c
+++ b/monitor/analyze.c
@@ -172,15 +172,18 @@ static void conn_destroy(void *data)
print_field("%lu RX packets", conn->rx_num);
print_field("%lu TX packets", conn->tx_num);
print_field("%lu TX completed packets", conn->tx_num_comp);
- print_field("%ld msec min latency",
- conn->tx_lat_min.tv_sec * 1000 +
- conn->tx_lat_min.tv_usec / 1000);
- print_field("%ld msec max latency",
- conn->tx_lat_max.tv_sec * 1000 +
- conn->tx_lat_max.tv_usec / 1000);
- print_field("%ld msec median latency",
- conn->tx_lat_med.tv_sec * 1000 +
- conn->tx_lat_med.tv_usec / 1000);
+ print_field("%lld msec min latency",
+ (long long)
+ (conn->tx_lat_min.tv_sec * 1000 +
+ conn->tx_lat_min.tv_usec / 1000));
+ print_field("%lld msec max latency",
+ (long long)
+ (conn->tx_lat_max.tv_sec * 1000 +
+ conn->tx_lat_max.tv_usec / 1000));
+ print_field("%lld msec median latency",
+ (long long)
+ (conn->tx_lat_med.tv_sec * 1000 +
+ conn->tx_lat_med.tv_usec / 1000));
print_field("%u octets TX min packet size", conn->tx_pkt_min);
print_field("%u octets TX max packet size", conn->tx_pkt_max);
print_field("%u octets TX median packet size", conn->tx_pkt_med);
diff --git a/monitor/packet.c b/monitor/packet.c
index 1344fd5b2503..1a41498e9c52 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -384,8 +384,9 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident,
}
if (filter_mask & PACKET_FILTER_SHOW_TIME) {
- n = sprintf(ts_str + ts_pos, " %02d:%02d:%02d.%06lu",
- tm.tm_hour, tm.tm_min, tm.tm_sec, tv->tv_usec);
+ n = sprintf(ts_str + ts_pos, " %02d:%02d:%02d.%06llu",
+ tm.tm_hour, tm.tm_min, tm.tm_sec,
+ (long long)tv->tv_usec);
if (n > 0) {
ts_pos += n;
ts_len += n;
@@ -393,8 +394,9 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident,
}
if (filter_mask & PACKET_FILTER_SHOW_TIME_OFFSET) {
- n = sprintf(ts_str + ts_pos, " %lu.%06lu",
- tv->tv_sec - time_offset, tv->tv_usec);
+ n = sprintf(ts_str + ts_pos, " %llu.%06llu",
+ (long long)(tv->tv_sec - time_offset),
+ (long long)tv->tv_usec);
if (n > 0) {
ts_pos += n;
ts_len += n;
--
2.35.3
next prev parent reply other threads:[~2022-09-23 10:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 10:51 [PATCH BlueZ 1/3] client/player: fix printf format string Christian Eggers
2022-09-23 10:51 ` Christian Eggers [this message]
2022-09-23 10:51 ` [PATCH BlueZ 3/3] tools: fix printf format strings Christian Eggers
2022-09-23 12:19 ` [BlueZ,1/3] client/player: fix printf format string bluez.test.bot
2022-09-26 18:00 ` [PATCH BlueZ 1/3] " patchwork-bot+bluetooth
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=20220923105141.20176-2-ceggers@arri.de \
--to=ceggers@arri.de \
--cc=linux-bluetooth@vger.kernel.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