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

Re: [PATCH] Fixed format specifier width mismatch


On (20/12/15 16:29), Joseph Ates wrote:
>On some platforms PRIu64 is not necessarily the width of the
>LargestIntegralType. A new decimal format specifier for
>LargestIntegralType was added and replaces the invocations of PRIu64.
>---
> include/cmocka.h | 15 ++++++++++++++-
> src/cmocka.c     | 20 ++++++++++++++------
> 2 files changed, 28 insertions(+), 7 deletions(-)
>
>diff --git a/include/cmocka.h b/include/cmocka.h
>index 6242ff2..0a255e9 100644
>--- a/include/cmocka.h
>+++ b/include/cmocka.h
>@@ -79,7 +79,7 @@ typedef uintmax_t LargestIntegralType;
> #endif /* LargestIntegralType */
> #endif /* DOXYGEN */
> 
>-/* Printf format used to display LargestIntegralType. */
>+/* Printf format used to display LargestIntegralType as a hexidecimal. */
> #ifndef LargestIntegralTypePrintfFormat
> # ifdef _WIN32
> #  define LargestIntegralTypePrintfFormat "0x%I64x"
>@@ -92,6 +92,19 @@ typedef uintmax_t LargestIntegralType;
> # endif /* _WIN32 */
> #endif /* LargestIntegralTypePrintfFormat */
> 
>+/* Printf format used to display LargestIntegralType as a decimal. */
>+#ifndef LargestIntegralTypePrintfFormatDecimal
>+# ifdef _WIN32
>+#  define LargestIntegralTypePrintfFormatDecimal "%I64u"
character "%" is usually not part of format string macros

@see standard header file inttypes.h
(or manual page)

LS


Follow-Ups:
Re: [PATCH] Fixed format specifier width mismatchJoseph Ates <joey@xxxxxxxxxxxxxx>
References:
[PATCH] Fixed format specifier width mismatchJoseph Ates <joseph.ates@xxxxxxxxxxxxx>