From: Vadim Zeitlin Date: Sun, 11 Mar 2007 01:20:59 +0000 (+0000) Subject: fixed overflow when using sysconf() to retrieve free memory (bug 1524157) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/40f00746d2d77955a2e21d2c17c864be3218ef4c fixed overflow when using sysconf() to retrieve free memory (bug 1524157) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index c64721bafb..3688288505 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -994,12 +994,12 @@ wxMemorySize wxGetFreeMemory() return (wxMemorySize)memFree; } -#elif defined(__SUN__) && defined(_SC_AVPHYS_PAGES) - return (wxMemorySize)(sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE)); #elif defined(__SGI__) struct rminfo realmem; if ( sysmp(MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0 ) return ((wxMemorySize)realmem.physmem * sysconf(_SC_PAGESIZE)); +#elif defined(_SC_AVPHYS_PAGES) + return ((wxMemorySize)sysconf(_SC_AVPHYS_PAGES))*sysconf(_SC_PAGESIZE); //#elif defined(__FREEBSD__) -- might use sysctl() to find it out, probably #endif