From: Vadim Zeitlin Date: Sat, 25 Apr 2009 13:52:58 +0000 (+0000) Subject: build fixes for Borland in wxUSE_UNICODE_MSLU and wxHAS_HUGE_FILES cases; only define... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4bf3e3a702a5bec15888db7bf535a297e57b47fb 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 --- diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 427eb1974b..892db0ec6f 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -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 diff --git a/src/msw/mslu.cpp b/src/msw/mslu.cpp index 65ab5f9630..5d30eac705 100644 --- a/src/msw/mslu.cpp +++ b/src/msw/mslu.cpp @@ -223,33 +223,24 @@ 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 _stat((const char*)wxConvFile.cWX2MB(name), buffer); - else - 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); + return _stati64((const char*)wxConvFile.cWX2MB(name), buffer); else - return _wstati64(name, (stati64 *) buffer); + return _wstati64(name, buffer); } -#else -WXDLLIMPEXP_BASE int wxMSLU__wstati64(const wchar_t *name, struct _stati64 *buffer) +#else // !wxHAS_HUGE_FILES +WXDLLIMPEXP_BASE int wxMSLU__wstat(const wchar_t *name, wxStructStat *buffer) { if ( wxUsingUnicowsDll() ) - return _stati64((const char*)wxConvFile.cWX2MB(name), buffer); + return _stat((const char*)wxConvFile.cWX2MB(name), buffer); else - return _wstati64(name, buffer); + return _wstat(name, buffer); } -#endif //__BORLANDC__ + +#endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES #endif // compilers having wopen() &c