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 int
27 FUNC (const UNIT *s, size_t n, const char *iso639_language,
28 bool *resultp)
29 {
30 UNIT normsbuf[2048 / sizeof (UNIT)];
31 UNIT *norms;
32 size_t norms_length;
33 UNIT mappedbuf[2048 / sizeof (UNIT)];
34 UNIT *mapped_toupper;
35 UNIT *mapped_tolower;
36 UNIT *mapped_totitle;
37 size_t mapped_length;
38
39
40 norms_length = sizeof (normsbuf) / sizeof (UNIT);
41 norms = U_NORMALIZE (UNINORM_NFD, s, n, normsbuf, &norms_length);
42 if (norms == NULL)
43
44 return -1;
45
46 mapped_length = sizeof (mappedbuf) / sizeof (UNIT);
47
48
49 mapped_toupper = U_TOUPPER (norms, norms_length, iso639_language, NULL,
50 mappedbuf, &mapped_length);
51 if (mapped_toupper == NULL)
52 goto fail;
53
54
55 if (!(mapped_length == norms_length
56 && U_CMP (mapped_toupper, norms, norms_length) == 0))
57 {
58 if (mapped_toupper != mappedbuf)
59 free (mapped_toupper);
60 goto yes;
61 }
62
63
64 mapped_tolower = U_TOLOWER (norms, norms_length, iso639_language, NULL,
65 mapped_toupper, &mapped_length);
66 if (mapped_tolower == NULL)
67 {
68 if (mapped_toupper != mappedbuf)
69 {
70 int saved_errno = errno;
71 free (mapped_toupper);
72 errno = saved_errno;
73 }
74 goto fail;
75 }
76
77 if (mapped_toupper != mapped_tolower && mapped_toupper != mappedbuf)
78 free (mapped_toupper);
79
80
81 if (!(mapped_length == norms_length
82 && U_CMP (mapped_tolower, norms, norms_length) == 0))
83 {
84 if (mapped_tolower != mappedbuf)
85 free (mapped_tolower);
86 goto yes;
87 }
88
89
90 mapped_totitle = U_TOTITLE (norms, norms_length, iso639_language, NULL,
91 mapped_tolower, &mapped_length);
92 if (mapped_totitle == NULL)
93 {
94 if (mapped_tolower != mappedbuf)
95 {
96 int saved_errno = errno;
97 free (mapped_tolower);
98 errno = saved_errno;
99 }
100 goto fail;
101 }
102
103 if (mapped_tolower != mapped_totitle && mapped_tolower != mappedbuf)
104 free (mapped_tolower);
105
106
107 if (!(mapped_length == norms_length
108 && U_CMP (mapped_totitle, norms, norms_length) == 0))
109 {
110 if (mapped_totitle != mappedbuf)
111 free (mapped_totitle);
112 goto yes;
113 }
114
115 if (mapped_totitle != mappedbuf)
116 free (mapped_totitle);
117 if (norms != normsbuf)
118 free (norms);
119 *resultp = false;
120 return 0;
121
122 yes:
123 if (norms != normsbuf)
124 free (norms);
125 *resultp = true;
126 return 0;
127
128 fail:
129 if (norms != normsbuf)
130 {
131 int saved_errno = errno;
132 free (norms);
133 errno = saved_errno;
134 }
135 return -1;
136 }