From a5b8e43c9cefd0f3f1d0485ee4c5a8119460770d Mon Sep 17 00:00:00 2001 From: Hayden Roche Date: Fri, 25 Aug 2023 10:47:33 -0700 Subject: [PATCH] Fix format specifier for printing CAN message ID in CanMsg.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regarding the X format specifier: C standard §7.21.6.1: "The unsigned int argument is converted to ..." On some platforms (e.g. mbed_nano), uint32_t, which is what's being printed here, is an unsigned long int, so this code causes a compiler warning. The fix is to use the format specifiers from §7.8.1, specifically PRIX32. --- api/CanMsg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/CanMsg.h b/api/CanMsg.h index 5b120344..522e6541 100644 --- a/api/CanMsg.h +++ b/api/CanMsg.h @@ -12,7 +12,7 @@ * INCLUDE **************************************************************************************/ -#include +#include #include #include @@ -68,7 +68,7 @@ class CanMsg : public Printable size_t len = 0; /* Print the header. */ - len = snprintf(buf, sizeof(buf), "[%08X] (%d) : ", id, data_length); + len = snprintf(buf, sizeof(buf), "[%08" PRIX32 "] (%d) : ", id, data_length); size_t n = p.write(buf, len); /* Print the data. */ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy