Compilation fixes for wide char functions under IRIX with mipsPro.

Use correct (XPG5, not XPG4) version of wcsftime().

Bring the wide char functions only declared in std namespace into global one
under IRIX.

Declare vswscanf() ourselves as we just don't seem to get its declaration from
C++ code (only from C99).

Add a cast to fix incorrect putws() signature.

All these fixes apply to IRIX 6.5.18 with mipsPro 7.4.2. It doesn't seem to
add configure checks for most of the above fixes as previous versions of both
the OS and the compiler should be completely extinct by now but we may need to
do it if anybody is still found to use them.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2010-02-28 11:09:15 +00:00
parent 3e026ad22e
commit d0204feee6
2 changed files with 36 additions and 5 deletions

View File

@ -643,10 +643,29 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name);
------------------------------------------------------------------------- */
#define wxCRT_StrftimeA strftime
#ifndef __WXPALMOS__
/* FIXME-UTF8: when is this available? */
#define wxCRT_StrftimeW wcsftime
#endif /* ! __WXPALMOS__ */
#ifdef __SGI__
/*
IRIX provides not one but two versions of wcsftime(): XPG4 one which
uses "const char*" for the third parameter and so can't be used and the
correct, XPG5, one. Unfortunately we can't just define _XOPEN_SOURCE
high enough to get XPG5 version as this undefines other symbols which
make other functions we use unavailable (see <standards.h> for gory
details). So just declare the XPG5 version ourselves, we're extremely
unlikely to ever be compiled on a system without it. But if we ever do,
a configure test would need to be added for it (and _MIPS_SYMBOL_PRESENT
should be used to check for its presence during run-time, i.e. it would
probably be simpler to just always use our own wxCRT_StrftimeW() below
if it does ever become a problem).
*/
extern "C" size_t
_xpg5_wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm * );
#define wxCRT_StrftimeW _xpg5_wcsftime
#else
#ifndef __WXPALMOS__
// assume it's always available, this does seem to be the case for now
#define wxCRT_StrftimeW wcsftime
#endif /* ! __WXPALMOS__ */
#endif
#ifndef wxCRT_StrftimeW
WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max,

View File

@ -29,6 +29,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#ifdef __SGI__
// wide character functions are declared in std namespace under IRIX
using namespace std;
// and this one is only declared if __c99 is defined which is not the case
// for C++ builds, so declare it ourselves
extern "C" int vswscanf(const wchar_t *, const wchar_t *, va_list);
#endif
#ifndef __WXPALMOS5__
#ifndef __WXWINCE__
@ -1246,9 +1256,11 @@ void wxUpdateLocaleIsUtf8()
int wxPuts(const wxString& s)
{
// under IRIX putws() takes a non-const argument so use wchar_str() instead
// of wc_str()
CALL_ANSI_OR_UNICODE(return,
wxCRT_PutsA(s.mb_str()),
wxCRT_PutsW(s.wc_str()));
wxCRT_PutsW(s.wchar_str()));
}
int wxFputs(const wxString& s, FILE *stream)