eclipse / tahu

Eclipse Tahu addresses the existence of legacy SCADA/DCS/ICS protocols and infrastructures and provides a much-needed definition of how best to apply MQTT into these existing industrial operational environments.
https://eclipse.org/tahu
Eclipse Public License 2.0
216 stars 123 forks source link

c/core: Use <inttypes.h> macros to construct printf format specifiers #358

Closed ian-abbott closed 4 months ago

ian-abbott commented 4 months ago

Avoid warnings about printf parameter types not matching the format specifiers by using the macros defined by #include <inttypes.h> to construct the format specifiers. Also fix some format specifiers for parameters of type size_t.

The types of pb_size_t and pb_ssize_t depend on whether the PB_FIELD_32BIT macro is defined or not in "pb.h", so add macros to "tahu.h" that expand to the correct printf and scanf format specifiers for pb_size_t and pb_ssize_t. For example, define PRI_u_PB_SIZE to expand to PRIu32 if PB_FIELD_32BIT is defined, or to PRIuLEAST16 if PB_FIELD_32BIT is undefined. (The underscore after PRI avoids clashes with identifiers reserved for future use by <inttypes.h>.)