+//
+// 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* wxMemchr(const wxChar* s, wxChar c, size_t l)
+ {
+ for(;l && *s != c;--l, ++s) {}
+
+ if(l)
+ return (wxChar*)s;
+ return NULL;
+ }
+
+ inline int wxMemcmp(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* wxMemcpy(wxChar* szOut, const wxChar* szIn, size_t len)
+ {
+ return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar));
+ }
+
+ inline wxChar* wxMemmove(wxChar* szOut, const wxChar* szIn, size_t len)
+ {
+ return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar));
+ }
+
+ inline wxChar* wxMemset(wxChar* szOut, const wxChar cIn, size_t len)
+ {
+ wxChar* szRet = szOut;
+
+ while (len--)
+ *szOut++ = cIn;
+
+ return szRet;
+ }
+
+ #else //!wxUSE_UNICODE
+ # define wxMemchr memchr
+ # define wxMemcmp memcmp
+ # define wxMemcpy memcpy
+ # define wxMemmove memmove
+ # define wxMemset memset
+ #endif
+
+#endif /*__cplusplus*/
+
+