From 1b9aea321374304b5612863844aaf421d8edacf4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 9 Feb 2023 11:23:03 -0800 Subject: [PATCH] garmin parser: avoid build warning about converting pointer types DECLARE_FIELD() uses array_uint_endian() to turn an integer type into the right endianness. It's all conditional on being an integer type, but the compiler still sees the assignment (with a cast) for other types, and complains about casting the 'unsigned int' return value to a pointer, even when that case is not actually dynamically ever taken. Fix the compiler warning by just changing the return type of this conversion function to 'unsigned long' instead, which will match the size of pointers on all relevant architectures. Don't look at that macro too closely, you'll go blind. Signed-off-by: Linus Torvalds --- src/garmin_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/garmin_parser.c b/src/garmin_parser.c index de63097..067aa92 100644 --- a/src/garmin_parser.c +++ b/src/garmin_parser.c @@ -449,7 +449,7 @@ static inline int base_type_is_integer(unsigned char base_type) return !memcmp(base_type_info[base_type].type_name + 1, "INT", 3); } -static inline unsigned int array_uint_endian(const unsigned char *p, unsigned int type_size, unsigned char bigendian) +static inline unsigned long array_uint_endian(const unsigned char *p, unsigned int type_size, unsigned char bigendian) { if (bigendian) return array_uint_be(p, type_size);