commit: 6e9679c1f6fe3b64ebbeb4a94dcc0060b3e6356d
parent a950de9dc006669f8fde2deef5fb8c70232b3ecd
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 13 Mar 2022 11:35:05 +0100
fmt_test: Fix uint64_t literal and printing
Diffstat:
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/fmt_test.c b/fmt_test.c
@@ -5,6 +5,8 @@
#include "fmt.h"
#include <glib.h>
+#include <inttypes.h> // PRIu64
+#include <stdint.h> // UINT64_C
static void
fmt_context_id_test(void)
@@ -15,24 +17,24 @@ fmt_context_id_test(void)
uint64_t context_id;
} cases[] = {
//
- {"A: ", 0},
- {"B: ", 1},
- {"Y: ", 24},
- {"Z: ", 25},
- {"AA: ", 26},
- {"AB: ", 27},
- {"AZ: ", 51},
- {"BA: ", 52},
- {"BB: ", 53},
- {"QKWW: ", 4294967296}, // 2^32
- {"JFHI: ", 9223372036854775808}, // 2^63
- {"TLPO: ", 18446744073709551614}, // 2^64 -2
- {"TLPP: ", 18446744073709551615}, // 2^64 -1 (aka UINT64_MAX)
+ {"A: ", UINT64_C(0)},
+ {"B: ", UINT64_C(1)},
+ {"Y: ", UINT64_C(24)},
+ {"Z: ", UINT64_C(25)},
+ {"AA: ", UINT64_C(26)},
+ {"AB: ", UINT64_C(27)},
+ {"AZ: ", UINT64_C(51)},
+ {"BA: ", UINT64_C(52)},
+ {"BB: ", UINT64_C(53)},
+ {"QKWW: ", UINT64_C(4294967296)}, // 2^32
+ {"JFHI: ", UINT64_C(9223372036854775808)}, // 2^63
+ {"TLPO: ", UINT64_C(18446744073709551614)}, // 2^64 -2
+ {"TLPP: ", UINT64_C(18446744073709551615)}, // 2^64 -1 (aka UINT64_MAX)
};
for(size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); i++)
{
- g_info("fmt_context_id(%lu)", cases[i].context_id);
+ g_info("fmt_context_id(%" PRIu64 ")", cases[i].context_id);
/* flawfinder: ignore. bound checks are done */
char got[BADWOLF_CTX_SIZ] = {0, 0, 0, 0, 0, 0, 0};