Commit 6807e0ef authored by jan.koester's avatar jan.koester
Browse files

test

parent ad2ae2f0
Loading
Loading
Loading
Loading
+3 −0
Changes for include/wchar.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -62,6 +62,9 @@ extern "C" {
    wchar_t *wcsncat(wchar_t *d, const wchar_t *s, size_t n);
    int      wcscmp(const wchar_t *l, const wchar_t *r);
    int      wcsncmp(const wchar_t *l, const wchar_t *r, size_t n);
    /* POSIX 2008 (real gap: googletest's String::CaseInsensitiveWideCStringEquals) */
    int      wcscasecmp(const wchar_t *l, const wchar_t *r);
    int      wcsncasecmp(const wchar_t *l, const wchar_t *r, size_t n);
    int      wcscoll(const wchar_t *l, const wchar_t *r);
    int      wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t loc);
    size_t   wcsspn(const wchar_t *s, const wchar_t *c);
+11 −0
Changes for src/linux/wchar.cpp: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -339,6 +339,17 @@ extern "C" {
        return n ? (*l < *r ? -1 : *l > *r) : 0;
    }

    int wcsncasecmp(const wchar_t *l, const wchar_t *r, size_t n){
        for (; n && *l && towlower(*l) == towlower(*r); n--, l++, r++) {}
        if (!n) return 0;
        wint_t a = towlower(*l), b = towlower(*r);
        return a < b ? -1 : a > b;
    }

    int wcscasecmp(const wchar_t *l, const wchar_t *r){
        return wcsncasecmp(l, r, (size_t)-1);
    }

    /* Only the C locale exists: collation is code point order. */
    int wcscoll(const wchar_t *l, const wchar_t *r){
        return wcscmp(l, r);