+/*
+ RN: The following are not normal versions of memcpy et al., rather
+ these are either char or widechar versions depending on
+ if unicode is used or not.
+*/
+
+#ifdef __cplusplus
+
+ //
+ // RN: We could do the usual tricky compiler detection here,
+ // and use their variant (such as wmemchr, etc.). The problem
+ // is that these functions are quite rare, even though they are
+ // part of the current POSIX standard. In addition, most compilers
+ // (including even MSC) inline them just like we do right in their
+ // headers.
+ //
+ #if wxUSE_UNICODE
+ #include <string.h> //for mem funcs
+
+ //implement our own wmem variants
+ inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l)
+ {
+ for(;l && *s != c;--l, ++s) {}
+
+ if(l)
+ return (wxChar*)s;
+ return NULL;
+ }
+
+ inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len)
+ {
+ for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {}
+
+ if(len)
+ return *sz1 < *sz2 ? -1 : *sz1 > *sz2;
+ else
+ return 0;
+ }
+
+ inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len)
+ {
+ return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar));
+ }
+
+ inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len)
+ {
+ return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar));
+ }
+
+ inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len)
+ {
+ wxChar* szRet = szOut;
+
+ while (len--)
+ *szOut++ = cIn;
+
+ return szRet;
+ }
+
+ #else /* !wxUSE_UNICODE */
+ # define wxTmemchr memchr
+ # define wxTmemcmp memcmp
+ # define wxTmemcpy memcpy
+ # define wxTmemmove memmove
+ # define wxTmemset memset
+ #endif /* wxUSE_UNICODE/!wxUSE_UNICODE */
+
+#endif /*__cplusplus*/
+
+
+#endif /* _WX_WXCHAR_H_ */