Skip to content

Commit 6e43400

Browse files
authored
Fix -Wunterminated-string-initialization warning (#787)
Unbreaks the Cygwin build.
1 parent 1b957f7 commit 6e43400

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

cutils.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,13 @@ size_t utf8_encode_buf16(char *dest, size_t dest_len, const uint16_t *src, size_
590590
*/
591591

592592
/* 2 <= base <= 36 */
593-
char const digits36[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
593+
char const digits36[36] = {
594+
'0','1','2','3','4','5','6','7','8','9',
595+
'a','b','c','d','e','f','g','h','i','j',
596+
'k','l','m','n','o','p','q','r','s','t',
597+
'u','v','w','x','y','z'
598+
};
599+
594600

595601
#define USE_SPECIAL_RADIX_10 1 // special case base 10 radix conversions
596602
#define USE_SINGLE_CASE_FAST 1 // special case single digit numbers

tests/test_conv.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ size_t i64toa_radix(char buf[minimum_length(66)], int64_t n, unsigned base);
133133
*/
134134

135135
/* 2 <= base <= 36 */
136-
char const digits36[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
136+
char const digits36[36] = {
137+
'0','1','2','3','4','5','6','7','8','9',
138+
'a','b','c','d','e','f','g','h','i','j',
139+
'k','l','m','n','o','p','q','r','s','t',
140+
'u','v','w','x','y','z'
141+
};
137142

138143
/*---- variants ----*/
139144

@@ -238,7 +243,7 @@ define_i64toa(shift)
238243
#endif /* TEST_SHIFTBUF */
239244

240245
#if defined(TEST_DIGIT_PAIRS) || defined(TEST_DIGIT_1PASS)
241-
static char const digits100[200] =
246+
static char const digits100[] =
242247
"00010203040506070809"
243248
"10111213141516171819"
244249
"20212223242526272829"

0 commit comments

Comments
 (0)