From 854d78eef30abe46aa0885f75ee1f523175736e6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 11 Nov 2022 12:41:04 +0000 Subject: [PATCH] Fix build failure on Visual Studio. Unlike clang, VS didn't like me using the value of one 'static const' integer variable to compute the value of another, and complained 'initializer is not a constant'. Replaced all those variables with an enum, which should also more reliably ensure that even an unsophisticated compiler doesn't actually reserve data-section space for them. --- utils/unicode-norm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/utils/unicode-norm.c b/utils/unicode-norm.c index 24eb70f1..8b6ca8d2 100644 --- a/utils/unicode-norm.c +++ b/utils/unicode-norm.c @@ -40,10 +40,17 @@ static void ucharbuf_free(ucharbuf *ub) * Hangul to jamo, from section 3.12 of Unicode 15.0.0. The following * constant names match those in the spec. */ -static const uchar SBase = 0xAC00; -static const uchar LBase = 0x1100, VBase = 0x1161, TBase = 0x11A7; -static const uchar LCount = 19, VCount = 21, TCount = 28; -static const uchar NCount = VCount * TCount, SCount = LCount * NCount; +enum { + SBase = 0xAC00, /* base index for precomposed Hangul */ + LBase = 0x1100, /* base index for L (leading consonant) jamo */ + VBase = 0x1161, /* base index for V (vowel) jamo */ + TBase = 0x11A7, /* base index for T (trailing consonant) jamo */ + LCount = 19, /* number of L jamo */ + VCount = 21, /* number of V jamo */ + TCount = 28, /* number of T jamo, including not having one at all */ + NCount = VCount * TCount, /* number of Hangul for each L jamo */ + SCount = LCount * NCount, /* number of Hangul in total */ +}; static cclass_t combining_class(uchar c) {