always use wxString::operator[](size_t) - wxWin doesn't compile without it anyhow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4219 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
48
configure.in
48
configure.in
@@ -223,51 +223,6 @@ AC_DEFUN(WX_CPP_BOOL,
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
|
||||||
dnl WX_CPP_SIZE_T_IS_NOT_INT checks whether size_t and int are different types,
|
|
||||||
dnl i.e. whether we may overload operator[] on its argument type
|
|
||||||
dnl ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
AC_DEFUN(WX_CPP_SIZE_T_IS_NOT_INT,
|
|
||||||
[
|
|
||||||
AC_CACHE_CHECK([if size_t and int are different types], wx_cv_cpp_sizet_not_int,
|
|
||||||
[
|
|
||||||
AC_LANG_SAVE
|
|
||||||
AC_LANG_CPLUSPLUS
|
|
||||||
|
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
class S
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
S(char *s) { m_s = s; }
|
|
||||||
|
|
||||||
char operator[](size_t n) const { return m_s[n]; }
|
|
||||||
char operator[](int n) const { return m_s[n]; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
char *m_s;
|
|
||||||
};
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
S s("dummy");
|
|
||||||
size_t n1 = 2;
|
|
||||||
int n2 = 3;
|
|
||||||
|
|
||||||
return s[n1] == s[n2];
|
|
||||||
}
|
|
||||||
],
|
|
||||||
AC_DEFINE(wxUSE_SIZE_T_STRING_OPERATOR) wx_cv_cpp_sizet_not_int=yes,
|
|
||||||
wx_cv_cpp_sizet_not_int=no,
|
|
||||||
wx_cv_cpp_sizet_not_int=no
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_LANG_RESTORE
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
|
dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
@@ -1903,9 +1858,6 @@ WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
|
|||||||
dnl check whether C++ compiler supports bool built-in type
|
dnl check whether C++ compiler supports bool built-in type
|
||||||
WX_CPP_BOOL
|
WX_CPP_BOOL
|
||||||
|
|
||||||
dnl check whether overloading on size_t/int parameter works
|
|
||||||
WX_CPP_SIZE_T_IS_NOT_INT
|
|
||||||
|
|
||||||
dnl check whether we should define _GNU_SOURCE
|
dnl check whether we should define _GNU_SOURCE
|
||||||
WX_GNU_EXTENSIONS
|
WX_GNU_EXTENSIONS
|
||||||
|
|
||||||
|
@@ -370,14 +370,9 @@ public:
|
|||||||
wxChar& Last()
|
wxChar& Last()
|
||||||
{ wxASSERT( !IsEmpty() ); CopyBeforeWrite(); return m_pchData[Len()-1]; }
|
{ wxASSERT( !IsEmpty() ); CopyBeforeWrite(); return m_pchData[Len()-1]; }
|
||||||
|
|
||||||
// under Unix it is tested with configure, assume it works on other
|
|
||||||
// platforms (there might be overloading problems if size_t and int are
|
|
||||||
// the same type)
|
|
||||||
#if !defined(__UNIX__) || wxUSE_SIZE_T_STRING_OPERATOR
|
|
||||||
// operator version of GetChar
|
// operator version of GetChar
|
||||||
wxChar operator[](size_t n) const
|
wxChar operator[](size_t n) const
|
||||||
{ ASSERT_VALID_INDEX( n ); return m_pchData[n]; }
|
{ ASSERT_VALID_INDEX( n ); return m_pchData[n]; }
|
||||||
#endif
|
|
||||||
|
|
||||||
// operator version of GetChar
|
// operator version of GetChar
|
||||||
wxChar operator[](int n) const
|
wxChar operator[](int n) const
|
||||||
|
@@ -399,13 +399,6 @@
|
|||||||
*/
|
*/
|
||||||
#define wxUSE_WCSRTOMBS 0
|
#define wxUSE_WCSRTOMBS 0
|
||||||
|
|
||||||
/*
|
|
||||||
* On some platforms overloading on size_t/int doesn't work, yet we'd like
|
|
||||||
* to define both size_t and int version of wxString::operator[] because it
|
|
||||||
* should really be size_t, but a lot of old, broken code uses int indices.
|
|
||||||
*/
|
|
||||||
#define wxUSE_SIZE_T_STRING_OPERATOR 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the new experimental implementation of wxString::Printf()?
|
* Use the new experimental implementation of wxString::Printf()?
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user