From 37527baf519af2b84e66e4f001e8cbe490d0c2e0 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 18 Aug 2020 12:16:03 +0800 Subject: [PATCH] Remove unused functions to avoid deprecated sysctl --- lib/irrlicht/include/IOSOperator.h | 12 --- lib/irrlicht/source/Irrlicht/COSOperator.cpp | 89 -------------------- lib/irrlicht/source/Irrlicht/COSOperator.h | 11 --- 3 files changed, 112 deletions(-) diff --git a/lib/irrlicht/include/IOSOperator.h b/lib/irrlicht/include/IOSOperator.h index dac6342ab..304fe8ffd 100644 --- a/lib/irrlicht/include/IOSOperator.h +++ b/lib/irrlicht/include/IOSOperator.h @@ -39,18 +39,6 @@ public: #else virtual const c8* getTextFromClipboard() const = 0; #endif - - //! Get the processor speed in megahertz - /** \param MHz The integer variable to store the speed in. - \return True if successful, false if not */ - virtual bool getProcessorSpeedMHz(u32* MHz) const = 0; - - //! Get the total and available system RAM - /** \param Total: will contain the total system memory - \param Avail: will contain the available memory - \return True if successful, false if not */ - virtual bool getSystemMemory(u32* Total, u32* Avail) const = 0; - }; } // end namespace diff --git a/lib/irrlicht/source/Irrlicht/COSOperator.cpp b/lib/irrlicht/source/Irrlicht/COSOperator.cpp index dc1587975..84d17e758 100644 --- a/lib/irrlicht/source/Irrlicht/COSOperator.cpp +++ b/lib/irrlicht/source/Irrlicht/COSOperator.cpp @@ -14,11 +14,6 @@ #if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__) && !defined(__HAIKU__) #include #include -#if defined(ANDROID) || (defined(__linux__) && !defined(__GLIBC__)) -#include -#else -#include -#endif #endif #endif @@ -184,89 +179,5 @@ const c8* COSOperator::getTextFromClipboard() const #endif -bool COSOperator::getProcessorSpeedMHz(u32* MHz) const -{ -#if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE ) && !defined (_IRR_XBOX_PLATFORM_) - LONG Error; - - HKEY Key; - Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - __TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), - 0, KEY_READ, &Key); - - if(Error != ERROR_SUCCESS) - return false; - - DWORD Speed = 0; - DWORD Size = sizeof(Speed); - Error = RegQueryValueEx(Key, __TEXT("~MHz"), NULL, NULL, (LPBYTE)&Speed, &Size); - - RegCloseKey(Key); - - if (Error != ERROR_SUCCESS) - return false; - else if (MHz) - *MHz = Speed; - _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; - return true; - -#elif defined(_IRR_OSX_PLATFORM_) - struct clockinfo CpuClock; - size_t Size = sizeof(clockinfo); - - if (!sysctlbyname("kern.clockrate", &CpuClock, &Size, NULL, 0)) - return false; - else if (MHz) - *MHz = CpuClock.hz; - return true; -#else - // could probably be read from "/proc/cpuinfo" or "/proc/cpufreq" - - return false; -#endif -} - -bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const -{ -#if defined(_IRR_WINDOWS_API_) && !defined (_IRR_XBOX_PLATFORM_) - MEMORYSTATUS MemoryStatus; - MemoryStatus.dwLength = sizeof(MEMORYSTATUS); - - // cannot fail - GlobalMemoryStatus(&MemoryStatus); - - if (Total) - *Total = (u32)(MemoryStatus.dwTotalPhys>>10); - if (Avail) - *Avail = (u32)(MemoryStatus.dwAvailPhys>>10); - - _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; - return true; - -#elif defined(_IRR_POSIX_API_) && !defined(__FreeBSD__) -#if defined(_SC_PHYS_PAGES) && defined(_SC_AVPHYS_PAGES) - long ps = sysconf(_SC_PAGESIZE); - long pp = sysconf(_SC_PHYS_PAGES); - long ap = sysconf(_SC_AVPHYS_PAGES); - - if ((ps==-1)||(pp==-1)||(ap==-1)) - return false; - - if (Total) - *Total = (u32)((ps*(long long)pp)>>10); - if (Avail) - *Avail = (u32)((ps*(long long)ap)>>10); - return true; -#else - // TODO: implement for non-availablity of symbols/features - return false; -#endif -#else - // TODO: implement for OSX - return false; -#endif -} - - } // end namespace diff --git a/lib/irrlicht/source/Irrlicht/COSOperator.h b/lib/irrlicht/source/Irrlicht/COSOperator.h index de09d6280..8e0026cce 100644 --- a/lib/irrlicht/source/Irrlicht/COSOperator.h +++ b/lib/irrlicht/source/Irrlicht/COSOperator.h @@ -39,17 +39,6 @@ public: virtual const c8* getTextFromClipboard() const; #endif - //! gets the processor speed in megahertz - //! \param Mhz: - //! \return Returns true if successful, false if not - virtual bool getProcessorSpeedMHz(u32* MHz) const; - - //! gets the total and available system RAM in kB - //! \param Total: will contain the total system memory - //! \param Avail: will contain the available memory - //! \return Returns true if successful, false if not - virtual bool getSystemMemory(u32* Total, u32* Avail) const; - private: core::stringc OperatingSystem;