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
This commit is contained in:
Vadim Zeitlin
2007-08-04 21:33:42 +00:00
parent 628f9e9596
commit de34bb081b
2 changed files with 21 additions and 24 deletions

View File

@@ -71,10 +71,13 @@ Changes in behaviour which may result in compilation errors
- Virtual wxHtmlParser::AddText() takes wxString, not wxChar*, argument now. - 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 are deprecated and passing NULL to them won't compile anymore, wxEmptyString
must be used instead. 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 insecure wxGets() and wxTmpnam() functions.
- Removed global GetLine() function from wx/protocol/protocol.h, use - Removed global GetLine() function from wx/protocol/protocol.h, use

View File

@@ -72,9 +72,9 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
// (including even MSC) inline them just like we do right in their // (including even MSC) inline them just like we do right in their
// headers. // headers.
// //
#if wxUSE_UNICODE #include <string.h>
#include <string.h> //for mem funcs
#if wxUSE_UNICODE
//implement our own wmem variants //implement our own wmem variants
inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l) inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l)
{ {
@@ -114,27 +114,21 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
return szRet; return szRet;
} }
#endif /* wxUSE_UNICODE */
// and trivial wrappers for char* versions: // provide trivial wrappers for char* versions for both ANSI and Unicode builds
inline char* wxTmemchr(const char* s, char c, size_t len) // (notice that these intentionally return "char *" and not "void *" unlike the
{ return (char*)memchr(s, c, len); } // standard memxxx() for symmetry with the wide char versions):
inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len) inline char* wxTmemchr(const char* s, char c, size_t len)
{ return memcmp(sz1, sz2, len); } { return (char*)memchr(s, c, len); }
inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len)
{ return (char*)memcpy(szOut, szIn, len); } { return memcmp(sz1, sz2, len); }
inline char* wxTmemmove(char* szOut, const char* szIn, size_t len) inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len)
{ return (char*)memmove(szOut, szIn, len); } { return (char*)memcpy(szOut, szIn, len); }
inline char* wxTmemset(char* szOut, const char cIn, size_t len) inline char* wxTmemmove(char* szOut, const char* szIn, size_t len)
{ return (char*)memset(szOut, cIn, len); } { return (char*)memmove(szOut, szIn, len); }
inline char* wxTmemset(char* szOut, const char cIn, size_t len)
#else /* !wxUSE_UNICODE */ { return (char*)memset(szOut, cIn, len); }
#define wxTmemchr memchr
#define wxTmemcmp memcmp
#define wxTmemcpy memcpy
#define wxTmemmove memmove
#define wxTmemset memset
#endif /* wxUSE_UNICODE/!wxUSE_UNICODE */
// ============================================================================ // ============================================================================
@@ -160,7 +154,7 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// NB: we can't provide const wchar_t* (= wxChar*) overload, because calling // 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 // ambiguous
WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale); WXDLLIMPEXP_BASE char* wxSetlocale(int category, const char *locale);
inline char* wxSetlocale(int category, const wxCharBuffer& locale) inline char* wxSetlocale(int category, const wxCharBuffer& locale)