diff mbox series

[BlueZ,2/3] client/player: use long long for off_t print

Message ID 20230511002252.30868-2-alice@ayaya.dev
State New
Headers show
Series [BlueZ,1/3] build: set _FILE_OFFSET_BITS and _TIME_BITS to 64 universally | expand

Commit Message

psykose May 11, 2023, 12:22 a.m. UTC
%lld is guaranteed to be a 64-bit int, which we enforce via
-D_FILE_OFFSET_BITS=64.

Signed-off-by: psykose <alice@ayaya.dev>
---
 client/player.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luiz Augusto von Dentz May 15, 2023, 7:17 p.m. UTC | #1
Hi Psykose,

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

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.
diff mbox series

Patch

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);