From 6e434008f57d1a96cd23ed88c463255f0dcb1130 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 5 Jan 2025 21:42:18 +0100 Subject: [PATCH] Fix -Wunterminated-string-initialization warning (#787) Unbreaks the Cygwin build. --- cutils.c | 8 +++++++- tests/test_conv.c | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cutils.c b/cutils.c index 9f202e5..8dc27dd 100644 --- a/cutils.c +++ b/cutils.c @@ -590,7 +590,13 @@ overflow: */ /* 2 <= base <= 36 */ -char const digits36[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; +char const digits36[36] = { + '0','1','2','3','4','5','6','7','8','9', + 'a','b','c','d','e','f','g','h','i','j', + 'k','l','m','n','o','p','q','r','s','t', + 'u','v','w','x','y','z' +}; + #define USE_SPECIAL_RADIX_10 1 // special case base 10 radix conversions #define USE_SINGLE_CASE_FAST 1 // special case single digit numbers diff --git a/tests/test_conv.c b/tests/test_conv.c index d53e188..db4e58d 100644 --- a/tests/test_conv.c +++ b/tests/test_conv.c @@ -133,7 +133,12 @@ size_t i64toa_radix(char buf[minimum_length(66)], int64_t n, unsigned base); */ /* 2 <= base <= 36 */ -char const digits36[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; +char const digits36[36] = { + '0','1','2','3','4','5','6','7','8','9', + 'a','b','c','d','e','f','g','h','i','j', + 'k','l','m','n','o','p','q','r','s','t', + 'u','v','w','x','y','z' +}; /*---- variants ----*/ @@ -238,7 +243,7 @@ define_i64toa(shift) #endif /* TEST_SHIFTBUF */ #if defined(TEST_DIGIT_PAIRS) || defined(TEST_DIGIT_1PASS) -static char const digits100[200] = +static char const digits100[] = "00010203040506070809" "10111213141516171819" "20212223242526272829"