X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8f17876f2b49e831d817e0ce683ae4f4d1ee9fb1..0adad2d72ffb322510e78ea366c58adbd1e8082e:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 63c92780b9..8247bb6f9f 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -37,6 +37,12 @@ # endif #endif // HAVE_STATFS +#ifdef HAVE_STATVFS + #include + + #define statfs statvfs +#endif // HAVE_STATVFS + #if wxUSE_GUI #include "wx/unix/execute.h" #endif @@ -1005,11 +1011,9 @@ long wxGetFreeMemory() return -1; } -#ifndef __WXMAC__ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) { -#ifdef HAVE_STATFS - +#if defined(HAVE_STATFS) || defined(HAVE_STATVFS) struct statfs fs; if ( statfs(path, &fs) != 0 ) { @@ -1018,6 +1022,9 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) return FALSE; } + // under Solaris we might have to use fs.f_frsize instead as I think it + // may be a multiple of the block size in general (TODO) + if ( pTotal ) { *pTotal = wxLongLong(fs.f_blocks) * fs.f_bsize; @@ -1033,7 +1040,6 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) return FALSE; } -#endif // ---------------------------------------------------------------------------- // env vars @@ -1057,8 +1063,10 @@ bool wxGetEnv(const wxString& var, wxString *value) bool wxSetEnv(const wxString& variable, const wxChar *value) { #if defined(HAVE_SETENV) - return setenv(variable.mb_str(), value ? wxString(value).mb_str().data() - : NULL, 1 /* overwrite */) == 0; + return setenv(variable.mb_str(), + value ? (const char *)wxString(value).mb_str() + : NULL, + 1 /* overwrite */) == 0; #elif defined(HAVE_PUTENV) wxString s = variable; if ( value )