Re: [PATCH BlueZ] monitor: fix usage of size_t %z formater

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Brian,

On Wed, Jun 29, 2022 at 12:49 PM Brian Gix <brian.gix@xxxxxxxxx> wrote:
>
> Some versions of GCC use strict typing for the %z formater, so passing
> an argument of type uint64_t instead of size_t throws an error.
> ---
>  monitor/l2cap.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/monitor/l2cap.h b/monitor/l2cap.h
> index 00a8ffbbd..86113e59d 100644
> --- a/monitor/l2cap.h
> +++ b/monitor/l2cap.h
> @@ -291,7 +291,7 @@ static inline bool l2cap_frame_print_be64(struct l2cap_frame *frame,
>                 return false;
>         }
>
> -       print_field("%s: 0x%zx", label, u64);
> +       print_field("%s: 0x%zx", label, (size_t)u64);
>
>         return true;
>  }
> @@ -320,7 +320,7 @@ static inline bool l2cap_frame_print_le64(struct l2cap_frame *frame,
>                 return false;
>         }
>
> -       print_field("%s: 0x%zx", label, u64);
> +       print_field("%s: 0x%zx", label, (size_t)u64);
>
>         return true;
>  }
> --
> 2.36.1

I suspend we need to use something like PRIu64 macros, like we already
do in some of our code e.g.:

src/adapter.c:          sscanf(rand, "%" PRIu64, &ltk->rand);


-- 
Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux