int utf8_validate(conststruct unicode_map *um, conststruct qstr *str)
{ if (utf8nlen(um, UTF8_NFDI, str->name, str->len) < 0) return -1; return0;
}
EXPORT_SYMBOL(utf8_validate);
int utf8_strncmp(conststruct unicode_map *um, conststruct qstr *s1, conststruct qstr *s2)
{ struct utf8cursor cur1, cur2; int c1, c2;
if (utf8ncursor(&cur1, um, UTF8_NFDI, s1->name, s1->len) < 0) return -EINVAL;
if (utf8ncursor(&cur2, um, UTF8_NFDI, s2->name, s2->len) < 0) return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = utf8byte(&cur2);
if (c1 < 0 || c2 < 0) return -EINVAL; if (c1 != c2) return1;
} while (c1);
return0;
}
EXPORT_SYMBOL(utf8_strncmp);
int utf8_strncasecmp(conststruct unicode_map *um, conststruct qstr *s1, conststruct qstr *s2)
{ struct utf8cursor cur1, cur2; int c1, c2;
if (utf8ncursor(&cur1, um, UTF8_NFDICF, s1->name, s1->len) < 0) return -EINVAL;
if (utf8ncursor(&cur2, um, UTF8_NFDICF, s2->name, s2->len) < 0) return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = utf8byte(&cur2);
if (c1 < 0 || c2 < 0) return -EINVAL; if (c1 != c2) return1;
} while (c1);
return0;
}
EXPORT_SYMBOL(utf8_strncasecmp);
/* String cf is expected to be a valid UTF-8 casefolded *string.
*/ int utf8_strncasecmp_folded(conststruct unicode_map *um, conststruct qstr *cf, conststruct qstr *s1)
{ struct utf8cursor cur1; int c1, c2; int i = 0;
if (utf8ncursor(&cur1, um, UTF8_NFDICF, s1->name, s1->len) < 0) return -EINVAL;
do {
c1 = utf8byte(&cur1);
c2 = cf->name[i++]; if (c1 < 0) return -EINVAL; if (c1 != c2) return1;
} while (c1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.