23 static size_t convert_case(
char *dst,
size_t dstsize,
const char *src, ssize_t srclen,
136 convert_case(
char *dst,
size_t dstsize,
const char *src, ssize_t srclen,
140 CaseKind chr_casekind = str_casekind;
142 size_t result_len = 0;
146 (str_casekind !=
CaseTitle && !wbnext && !wbstate));
150 boundary = wbnext(wbstate);
154 while ((srclen < 0 || srcoff < srclen) && src[srcoff] !=
'\0')
162 if (srcoff == boundary)
165 boundary = wbnext(wbstate);
177 if (result_len + u2len <= dstsize)
185 if (result_len + u1len <= dstsize)
186 memcpy(dst + result_len, src + srcoff, u1len);
194 if (result_len < dstsize)
195 dst[result_len] =
'\0';
223 mid = (min + max) / 2;
226 else if (ucs <
case_map[mid].codepoint)
#define Assert(condition)
static pg_wchar utf8_to_unicode(const unsigned char *c)
static unsigned char * unicode_to_utf8(pg_wchar c, unsigned char *utf8string)
static int unicode_utf8len(pg_wchar c)
pg_wchar simplemap[NCaseKind]
pg_wchar unicode_uppercase_simple(pg_wchar code)
size_t unicode_strlower(char *dst, size_t dstsize, const char *src, ssize_t srclen)
pg_wchar unicode_titlecase_simple(pg_wchar code)
size_t unicode_strupper(char *dst, size_t dstsize, const char *src, ssize_t srclen)
static size_t convert_case(char *dst, size_t dstsize, const char *src, ssize_t srclen, CaseKind str_casekind, WordBoundaryNext wbnext, void *wbstate)
static const pg_case_map * find_case_map(pg_wchar ucs)
pg_wchar unicode_lowercase_simple(pg_wchar code)
size_t unicode_strtitle(char *dst, size_t dstsize, const char *src, ssize_t srclen, WordBoundaryNext wbnext, void *wbstate)
size_t(* WordBoundaryNext)(void *wbstate)
static const pg_case_map case_map[2955]