2023-05-11 00:42:08

by alice

[permalink] [raw]
Subject: [PATCH BlueZ 2/3] client/player: use long long for off_t print

%lld is guaranteed to be a 64-bit int, which we enforce via
-D_FILE_OFFSET_BITS=64.

Signed-off-by: psykose <[email protected]>
---
client/player.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/player.c b/client/player.c
index 7719076c8..856997319 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3578,7 +3578,7 @@ static int transport_send_seq(struct transport *transport, int fd, uint32_t num)

offset = lseek(fd, 0, SEEK_CUR);

- bt_shell_echo("[seq %d %d.%03ds] send: %zd/%zd bytes",
+ bt_shell_echo("[seq %d %d.%03ds] send: %lld/%lld bytes",
transport->seq, secs,
(nsecs + 500000) / 1000000,
offset, transport->stat.st_size);
--
2.40.1



2023-05-15 19:24:09

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 2/3] client/player: use long long for off_t print

Hi Psykose,

On Wed, May 10, 2023 at 5:42 PM psykose <[email protected]> wrote:
>
> %lld is guaranteed to be a 64-bit int, which we enforce via
> -D_FILE_OFFSET_BITS=64.
>
> Signed-off-by: psykose <[email protected]>

We don't use Signed-off-by for userspace patches.

> ---
> client/player.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/client/player.c b/client/player.c
> index 7719076c8..856997319 100644
> --- a/client/player.c
> +++ b/client/player.c
> @@ -3578,7 +3578,7 @@ static int transport_send_seq(struct transport *transport, int fd, uint32_t num)
>
> offset = lseek(fd, 0, SEEK_CUR);
>
> - bt_shell_echo("[seq %d %d.%03ds] send: %zd/%zd bytes",
> + bt_shell_echo("[seq %d %d.%03ds] send: %lld/%lld bytes",
> transport->seq, secs,
> (nsecs + 500000) / 1000000,
> offset, transport->stat.st_size);
> --
> 2.40.1

Perhaps we just promote offset to intmax_t and then print with %jd,
that way it should work regardless of the actual size of off_t.

--
Luiz Augusto von Dentz