diff mbox series

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

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

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild fail [BlueZ,2/3] client/player: use long long for off_t print tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12655:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12655 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ client/player.c: In function ‘transport_send_seq’: client/player.c:3581:45: error: format ‘%lld’ expects argument of type ‘long long int’, but argument 5 has type ‘off_t’ {aka ‘long int’} [-Werror=format=] 3581 | bt_shell_echo("[seq %d %d.%03ds] send: %lld/%lld bytes", | ~~~^ | | | long long int | %ld ...... 3584 | offset, transport->stat.st_size); | ~~~~~~ | | | off_t {aka long int} client/player.c:3581:50: error: format ‘%lld’ expects argument of type ‘long long int’, but argument 6 has type ‘__off_t’ {aka ‘long int’} [-Werror=format=] 3581 | bt_shell_echo("[seq %d %d.%03ds] send: %lld/%lld bytes", | ~~~^ | | | long long int | %ld ...... 3584 | offset, transport->stat.st_size); | ~~~~~~~~~~~~~~~~~~~~~~~ | | | __off_t {aka long int} cc1: all warnings being treated as errors make[1]: *** [Makefile:7616: client/player.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4518: all] Error 2

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