From c1ce4db1dea14fb8afa70b9e826647d21b354145 Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Thu, 18 Aug 2005 11:40:40 +0000 Subject: [PATCH] wcslen and wcscmp replacements for systems that lack them, such as djgpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35222 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/mbconv/mbconvtest.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/mbconv/mbconvtest.cpp b/tests/mbconv/mbconvtest.cpp index 632ee3c8ba..d816bc855f 100644 --- a/tests/mbconv/mbconvtest.cpp +++ b/tests/mbconv/mbconvtest.cpp @@ -1106,6 +1106,28 @@ static wchar_t *wx_wcscat(wchar_t *dest, const wchar_t *src) return dest; } +// in case wcscmp is missing +// +static int wx_wcscmp(const wchar_t *s1, const wchar_t *s2) +{ + while (*s1 == *s2 && *s1 != 0) + { + s1++; + s2++; + } + return *s1 - *s2; +} + +// in case wcslen is missing +// +static size_t wx_wcslen(const wchar_t *s) +{ + const wchar_t *t = s; + while (*t != 0) + t++; + return t - s; +} + // include the option in the error messages so it's possible to see which // test failed #define UTF8ASSERT(expr) CPPUNIT_ASSERT_MESSAGE(#expr + errmsg, expr) @@ -1151,8 +1173,8 @@ void MBConvTestCase::UTF8(const char *charSequence, wx_wcscat(expected, L"XYZ"); wx_wcscat(expected, wideSequence); - UTF8ASSERT(wcscmp(widechars, expected) == 0); - UTF8ASSERT(wcslen(widechars) == result); + UTF8ASSERT(wx_wcscmp(widechars, expected) == 0); + UTF8ASSERT(wx_wcslen(widechars) == result); } else { // If 'wideSequence' is NULL, then the result is expected to be -- 2.47.2