]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: unicode-transform - Rename chr variables/parameters to cp
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 21 Mar 2025 05:09:21 +0000 (06:09 +0100)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 1 Aug 2025 01:11:19 +0000 (03:11 +0200)
These are code points and not characters per se.

src/lib/unicode-transform.c

index 667f1671bb7cc0d7fc92afb282de912ba090b459..529a7212996c84d7ebbc7ba00d811a5c3ee70133 100644 (file)
@@ -7,7 +7,7 @@
  * Hangul syllable (de)composition
  */
 
-static size_t unicode_hangul_decompose(uint32_t chr, uint32_t buf[3])
+static size_t unicode_hangul_decompose(uint32_t cp, uint32_t buf[3])
 {
        /* The Unicode Standard, Section 3.12.2:
           Hangul Syllable Decomposition
@@ -21,7 +21,7 @@ static size_t unicode_hangul_decompose(uint32_t chr, uint32_t buf[3])
        static const unsigned int t_count = 28;
        static const unsigned int n_count = (v_count * t_count);
 
-       unsigned int s_index = chr - s_base;
+       unsigned int s_index = cp - s_base;
        unsigned int l_index = s_index / n_count;
        unsigned int v_index = (s_index % n_count) / t_count;
        unsigned int t_index = s_index % t_count;
@@ -42,32 +42,32 @@ static size_t unicode_hangul_decompose(uint32_t chr, uint32_t buf[3])
        return 3;
 }
 
-static void uni_ucs4_decompose_hangul_utf8(uint32_t chr, buffer_t *output)
+static void uni_ucs4_decompose_hangul_utf8(uint32_t cp, buffer_t *output)
 {
        uint32_t buf[3];
        size_t len, i;
 
-       len = unicode_hangul_decompose(chr, buf);
+       len = unicode_hangul_decompose(cp, buf);
 
        for (i = 0; i < len; i++)
                uni_ucs4_to_utf8_c(buf[i], output);
 }
 
 static void
-uni_ucs4_decompose_one_utf8(uint32_t chr, bool canonical, buffer_t *output)
+uni_ucs4_decompose_one_utf8(uint32_t cp, bool canonical, buffer_t *output)
 {
        const uint32_t *decomp;
        size_t len, i;
 
-       if (chr >= HANGUL_FIRST && chr <= HANGUL_LAST) {
-               uni_ucs4_decompose_hangul_utf8(chr, output);
+       if (cp >= HANGUL_FIRST && cp <= HANGUL_LAST) {
+               uni_ucs4_decompose_hangul_utf8(cp, output);
                return;
        }
 
-       len = unicode_code_point_get_full_decomposition(chr, canonical,
+       len = unicode_code_point_get_full_decomposition(cp, canonical,
                                                        &decomp);
        if (len == 0) {
-               uni_ucs4_to_utf8_c(chr, output);
+               uni_ucs4_to_utf8_c(cp, output);
                return;
        }