This source file includes following definitions.
- FUNC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 UNIT *
27 FUNC (const UNIT *s, size_t n,
28 casing_prefix_context_t prefix_context,
29 casing_suffix_context_t suffix_context,
30 const char *iso639_language,
31 uninorm_t nf,
32 UNIT *resultbuf, size_t *lengthp)
33 {
34
35
36
37
38
39
40
41
42
43
44 if (nf == NULL)
45
46 return U_CASEMAP (s, n, prefix_context, suffix_context, iso639_language,
47 uc_tocasefold, offsetof (struct special_casing_rule, casefold[0]),
48 NULL,
49 resultbuf, lengthp);
50 else
51 {
52 uninorm_t nfd = uninorm_decomposing_form (nf);
53
54
55 int repeat = (uninorm_is_compat_decomposing (nf) ? 2 : 1);
56 UNIT tmpbuf1[2048 / sizeof (UNIT)];
57 UNIT tmpbuf2[2048 / sizeof (UNIT)];
58 UNIT *tmp1;
59 size_t tmp1_length;
60 UNIT *tmp2;
61 size_t tmp2_length;
62
63 tmp1_length = sizeof (tmpbuf1) / sizeof (UNIT);
64 tmp1 = U_NORMALIZE (UNINORM_NFD, s, n, tmpbuf1, &tmp1_length);
65 if (tmp1 == NULL)
66
67 return NULL;
68
69 do
70 {
71 tmp2_length = sizeof (tmpbuf2) / sizeof (UNIT);
72 tmp2 = U_CASEMAP (tmp1, tmp1_length,
73 prefix_context, suffix_context, iso639_language,
74 uc_tocasefold, offsetof (struct special_casing_rule, casefold[0]),
75 NULL,
76 tmpbuf2, &tmp2_length);
77 if (tmp2 == NULL)
78 {
79 int saved_errno = errno;
80 if (tmp1 != tmpbuf1)
81 free (tmp1);
82 errno = saved_errno;
83 return NULL;
84 }
85
86 if (tmp1 != tmpbuf1)
87 free (tmp1);
88
89 if (repeat > 1)
90 {
91 tmp1_length = sizeof (tmpbuf1) / sizeof (UNIT);
92 tmp1 = U_NORMALIZE (nfd, tmp2, tmp2_length,
93 tmpbuf1, &tmp1_length);
94 }
95 else
96
97 tmp1 = U_NORMALIZE (nf, tmp2, tmp2_length,
98 resultbuf, lengthp);
99 if (tmp1 == NULL)
100 {
101 int saved_errno = errno;
102 if (tmp2 != tmpbuf2)
103 free (tmp2);
104 errno = saved_errno;
105 return NULL;
106 }
107
108 if (tmp2 != tmpbuf2)
109 free (tmp2);
110 }
111 while (--repeat > 0);
112
113 return tmp1;
114 }
115 }