Added --with-unicode (not used yet) and --with-wcsrtombs options
to configurea and setup.h. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
27
configure.in
27
configure.in
@@ -708,6 +708,9 @@ DEFAULT_wxUSE_WXGRAPH=0
|
|||||||
DEFAULT_wxUSE_WXTREE=0
|
DEFAULT_wxUSE_WXTREE=0
|
||||||
DEFAULT_wxUSE_HELP=0
|
DEFAULT_wxUSE_HELP=0
|
||||||
|
|
||||||
|
DEFAULT_wxUSE_UNICODE=1
|
||||||
|
DEFAULT_wxUSE_WCSRTOMBS=0
|
||||||
|
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
dnl toolkit options
|
dnl toolkit options
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
@@ -876,6 +879,18 @@ AC_OVERRIDES(postscript, postscript,
|
|||||||
**--with-postscript use wxPostscriptDC device context,
|
**--with-postscript use wxPostscriptDC device context,
|
||||||
wxUSE_POSTSCRIPT)
|
wxUSE_POSTSCRIPT)
|
||||||
|
|
||||||
|
dnl ----------------------------------------------------------------
|
||||||
|
dnl user options for wxString and Unicode
|
||||||
|
dnl ----------------------------------------------------------------
|
||||||
|
|
||||||
|
AC_OVERRIDES(unicode,unicode,
|
||||||
|
**--with-unicode compile wxString with Unicode support,
|
||||||
|
wxUSE_UNICODE)
|
||||||
|
|
||||||
|
AC_OVERRIDES(wcsrtombs,wcsrtombs,
|
||||||
|
**--with-wcsrtombs use wcsrtombs instead of (buggy in GNU libc5) wcstombs,
|
||||||
|
wxUSE_WCSRTOMBS)
|
||||||
|
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
dnl user options for Prolog and Resources
|
dnl user options for Prolog and Resources
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
@@ -1248,6 +1263,18 @@ if test "$wxUSE_PRINTING_ARCHITECTURE" = 1 ; then
|
|||||||
AC_DEFINE_UNQUOTED(wxUSE_PRINTING_ARCHITECTURE,$wxUSE_PRINTING_ARCHITECTURE)
|
AC_DEFINE_UNQUOTED(wxUSE_PRINTING_ARCHITECTURE,$wxUSE_PRINTING_ARCHITECTURE)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl ----------------------------------------------------------------
|
||||||
|
dnl Register wxString options for makefiles and setup.h
|
||||||
|
dnl ----------------------------------------------------------------
|
||||||
|
|
||||||
|
if test "$wxUSE_UNICODE" = 1 ; then
|
||||||
|
AC_DEFINE_UNQUOTED(wxUSE_UNICODE)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$wxUSE_WCSRTOMBS" = 1 ; then
|
||||||
|
AC_DEFINE_UNQUOTED(wxUSE_WCSRTOMBS)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
dnl Register misc options for makefiles and setup.h
|
dnl Register misc options for makefiles and setup.h
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
|
@@ -149,6 +149,24 @@
|
|||||||
*/
|
*/
|
||||||
#undef wxUSE_POSTSCRIPT
|
#undef wxUSE_POSTSCRIPT
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// wxString options
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compile wxString with wide character (Unicode) support?
|
||||||
|
*/
|
||||||
|
#undef wxUSE_UNICODE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Work around a bug in GNU libc 5.x wcstombs() implementation.
|
||||||
|
*
|
||||||
|
* Note that you must link your programs with libc.a if you enable this and you
|
||||||
|
* have libc 5 (you should enable this for libc6 where wcsrtombs() is
|
||||||
|
* thread-safe version of wcstombs()).
|
||||||
|
*/
|
||||||
|
#undef wxUSE_WCSRTOMBS
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// misc options
|
// misc options
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
@@ -41,6 +41,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef wxUSE_WCSRTOMBS
|
||||||
|
#include <wchar.h> // for wcsrtombs(), see comments where it's used
|
||||||
|
#endif // GNU
|
||||||
|
|
||||||
#ifdef WXSTRING_IS_WXOBJECT
|
#ifdef WXSTRING_IS_WXOBJECT
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject)
|
||||||
#endif //WXSTRING_IS_WXOBJECT
|
#endif //WXSTRING_IS_WXOBJECT
|
||||||
@@ -216,7 +220,17 @@ wxString::wxString(const void *pStart, const void *pEnd)
|
|||||||
wxString::wxString(const wchar_t *pwz)
|
wxString::wxString(const wchar_t *pwz)
|
||||||
{
|
{
|
||||||
// first get necessary size
|
// first get necessary size
|
||||||
|
|
||||||
|
// NB: GNU libc5 wcstombs() is completely broken, don't use it (it doesn't
|
||||||
|
// honor the 3rd parameter, thus it will happily crash here).
|
||||||
|
#ifdef wxUSE_WCSRTOMBS
|
||||||
|
// don't know if it's really needed (or if we can pass NULL), but better safe
|
||||||
|
// than quick
|
||||||
|
mbstate_t mbstate;
|
||||||
|
size_t nLen = wcsrtombs((char *) NULL, &pwz, 0, &mbstate);
|
||||||
|
#else // !GNU libc
|
||||||
size_t nLen = wcstombs((char *) NULL, pwz, 0);
|
size_t nLen = wcstombs((char *) NULL, pwz, 0);
|
||||||
|
#endif // GNU
|
||||||
|
|
||||||
// empty?
|
// empty?
|
||||||
if ( nLen != 0 ) {
|
if ( nLen != 0 ) {
|
||||||
|
Reference in New Issue
Block a user