From de34bb081b6ce19bd4b1216d26a79b817a631bbd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Aug 2007 21:33:42 +0000 Subject: [PATCH] make wxTmemchr() return (and take) char* instead of void* in ANSI build too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 5 ++++- include/wx/wxcrt.h | 42 ++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 6a61677bd0..eaf72196de 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -71,10 +71,13 @@ Changes in behaviour which may result in compilation errors - Virtual wxHtmlParser::AddText() takes wxString, not wxChar*, argument now. -- Funtions that took wxChar* arguments that could by NULL in wxWidgets 2.8. +- Functions that took wxChar* arguments that could by NULL in wxWidgets 2.8. are deprecated and passing NULL to them won't compile anymore, wxEmptyString must be used instead. +- wxTmemxxx() functions take either wxChar* or char*, not void*: use memxxx() + with void pointers. + - Removed insecure wxGets() and wxTmpnam() functions. - Removed global GetLine() function from wx/protocol/protocol.h, use diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index b1608af826..433bc954b1 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -72,9 +72,9 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ // (including even MSC) inline them just like we do right in their // headers. // -#if wxUSE_UNICODE - #include //for mem funcs +#include +#if wxUSE_UNICODE //implement our own wmem variants inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) { @@ -114,27 +114,21 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ return szRet; } - - // and trivial wrappers for char* versions: - inline char* wxTmemchr(const char* s, char c, size_t len) - { return (char*)memchr(s, c, len); } - inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len) - { return memcmp(sz1, sz2, len); } - inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) - { return (char*)memcpy(szOut, szIn, len); } - inline char* wxTmemmove(char* szOut, const char* szIn, size_t len) - { return (char*)memmove(szOut, szIn, len); } - inline char* wxTmemset(char* szOut, const char cIn, size_t len) - { return (char*)memset(szOut, cIn, len); } - -#else /* !wxUSE_UNICODE */ - #define wxTmemchr memchr - #define wxTmemcmp memcmp - #define wxTmemcpy memcpy - #define wxTmemmove memmove - #define wxTmemset memset -#endif /* wxUSE_UNICODE/!wxUSE_UNICODE */ - +#endif /* wxUSE_UNICODE */ + +// provide trivial wrappers for char* versions for both ANSI and Unicode builds +// (notice that these intentionally return "char *" and not "void *" unlike the +// standard memxxx() for symmetry with the wide char versions): +inline char* wxTmemchr(const char* s, char c, size_t len) + { return (char*)memchr(s, c, len); } +inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len) + { return memcmp(sz1, sz2, len); } +inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) + { return (char*)memcpy(szOut, szIn, len); } +inline char* wxTmemmove(char* szOut, const char* szIn, size_t len) + { return (char*)memmove(szOut, szIn, len); } +inline char* wxTmemset(char* szOut, const char cIn, size_t len) + { return (char*)memset(szOut, cIn, len); } // ============================================================================ @@ -160,7 +154,7 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */ // ---------------------------------------------------------------------------- // NB: we can't provide const wchar_t* (= wxChar*) overload, because calling -// wxSetlocale(category, NULL) -- which is a common thing to do --would be +// wxSetlocale(category, NULL) -- which is a common thing to do -- would be // ambiguous WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale); inline char* wxSetlocale(int category, const wxCharBuffer& locale) -- 2.45.2