build fixes for Borland in wxUSE_UNICODE_MSLU and wxHAS_HUGE_FILES cases; only define one of wxMSLU__wstat and wxMSLU__wstati64; also define wxStructStat as 64 bit version of struct stat if needed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60345 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-04-25 13:52:58 +00:00
parent 4461c51850
commit 4bf3e3a702
2 changed files with 60 additions and 61 deletions

View File

@ -187,6 +187,8 @@ enum wxFileKind
// huge file support (or at least not all functions needed for it by wx)
// currently
// types
#ifdef wxHAS_HUGE_FILES
typedef wxLongLong_t wxFileOffset;
#define wxFileOffsetFmtSpec wxLongLongFmtSpec
@ -194,6 +196,46 @@ enum wxFileKind
typedef off_t wxFileOffset;
#endif
// at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope
// resolution operator present in wxPOSIX_IDENT for it
#ifdef __BORLANDC__
#define wxPOSIX_STRUCT(s) struct s
#else
#define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s)
#endif
// Notice that Watcom is the only compiler to have a wide char
// version of struct stat as well as a wide char stat function variant.
// This was dropped since OW 1.4 "for consistency across platforms".
//
// Borland is also special in that it uses _stat with Unicode functions
// (for MSVC compatibility?) but stat with ANSI ones
#ifdef __BORLANDC__
#if wxHAS_HUGE_FILES
#define wxStructStat struct stati64
#else
#if wxUSE_UNICODE
#define wxStructStat struct _stat
#else
#define wxStructStat struct stat
#endif
#endif
#else // !__BORLANDC__
#ifdef wxHAS_HUGE_FILES
#if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4)
#define wxStructStat struct _wstati64
#else
#define wxStructStat struct _stati64
#endif
#else
#if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4)
#define wxStructStat struct _wstat
#else
#define wxStructStat struct _stat
#endif
#endif
#endif // __BORLANDC__/!__BORLANDC__
// functions
@ -210,14 +252,6 @@ enum wxFileKind
#define wxHAS_UNDERSCORES_IN_POSIX_IDENTS
#endif
// at least Borland 5.5 doesn't like "struct ::stat" so don't use the scope
// resolution operator present in wxPOSIX_IDENT for it
#ifdef __BORLANDC__
#define wxPOSIX_STRUCT(s) struct s
#else
#define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s)
#endif
// first functions not working with strings, i.e. without ANSI/Unicode
// complications
#define wxClose wxPOSIX_IDENT(close)
@ -285,11 +319,13 @@ enum wxFileKind
WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name);
WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name);
WXDLLIMPEXP_BASE int
wxMSLU__wstat(const wxChar *name, wxPOSIX_STRUCT(stat) *buffer);
WXDLLIMPEXP_BASE int
wxMSLU__wstati64(const wxChar *name,
wxPOSIX_STRUCT(stati64) *buffer);
#ifdef wxHAS_HUGE_FILES
WXDLLIMPEXP_BASE int
wxMSLU__wstati64(const wxChar *name, wxStructStat *buffer);
#else // !wxHAS_HUGE_FILES
WXDLLIMPEXP_BASE int
wxMSLU__wstat(const wxChar *name, wxStructStat *buffer);
#endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES
#endif // Windows compilers with MSLU support
#define wxCRT_Open wxMSLU__wopen
@ -347,34 +383,6 @@ enum wxFileKind
#endif
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
// Types: Notice that Watcom is the only compiler to have a wide char
// version of struct stat as well as a wide char stat function variant.
// This was dropped since OW 1.4 "for consistency across platforms".
//
// Borland is also special in that it uses _stat with Unicode functions
// (for MSVC compatibility?) but stat with ANSI ones
#ifdef __BORLANDC__
#if wxUSE_UNICODE
#define wxStructStat struct _stat
#else
#define wxStructStat struct stat
#endif
#else // !__BORLANDC__
#ifdef wxHAS_HUGE_FILES
#if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4)
#define wxStructStat struct _wstati64
#else
#define wxStructStat struct _stati64
#endif
#else
#if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4)
#define wxStructStat struct _wstat
#else
#define wxStructStat struct _stat
#endif
#endif
#endif // __BORLANDC__/!__BORLANDC__
// constants (unless already defined by the user code)
#ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS
#ifndef O_RDONLY

View File

@ -223,7 +223,16 @@ WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wchar_t *name)
return _wrmdir(name);
}
WXDLLIMPEXP_BASE int wxMSLU__wstat(const wchar_t *name, struct _stat *buffer)
#ifdef wxHAS_HUGE_FILES
WXDLLIMPEXP_BASE int wxMSLU__wstati64(const wchar_t *name, wxStructStat *buffer)
{
if ( wxUsingUnicowsDll() )
return _stati64((const char*)wxConvFile.cWX2MB(name), buffer);
else
return _wstati64(name, buffer);
}
#else // !wxHAS_HUGE_FILES
WXDLLIMPEXP_BASE int wxMSLU__wstat(const wchar_t *name, wxStructStat *buffer)
{
if ( wxUsingUnicowsDll() )
return _stat((const char*)wxConvFile.cWX2MB(name), buffer);
@ -231,25 +240,7 @@ WXDLLIMPEXP_BASE int wxMSLU__wstat(const wchar_t *name, struct _stat *buffer)
return _wstat(name, buffer);
}
#ifdef __BORLANDC__
//here _stati64 is defined as stati64, see wx/filefn.h
#undef _stati64
WXDLLIMPEXP_BASE int wxMSLU__wstati64(const wchar_t *name, struct _stati64 *buffer)
{
if ( wxUsingUnicowsDll() )
return _stati64((const char*)wxConvFile.cWX2MB(name), (stati64 *) buffer);
else
return _wstati64(name, (stati64 *) buffer);
}
#else
WXDLLIMPEXP_BASE int wxMSLU__wstati64(const wchar_t *name, struct _stati64 *buffer)
{
if ( wxUsingUnicowsDll() )
return _stati64((const char*)wxConvFile.cWX2MB(name), buffer);
else
return _wstati64(name, buffer);
}
#endif //__BORLANDC__
#endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES
#endif // compilers having wopen() &c