Commit ecf8fe19 authored by hybrid's avatar hybrid

Make sure to initialize the mhz variable so in case we cannot read a value we return a safe 0

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4468 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 2e974673
...@@ -127,6 +127,8 @@ const c8* COSOperator::getTextFromClipboard() const ...@@ -127,6 +127,8 @@ const c8* COSOperator::getTextFromClipboard() const
bool COSOperator::getProcessorSpeedMHz(u32* MHz) const bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
{ {
if (MHz)
*MHz=0;
#if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE ) && !defined (_IRR_XBOX_PLATFORM_) #if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE ) && !defined (_IRR_XBOX_PLATFORM_)
LONG Error; LONG Error;
...@@ -148,7 +150,6 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const ...@@ -148,7 +150,6 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
return false; return false;
else if (MHz) else if (MHz)
*MHz = Speed; *MHz = Speed;
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return true; return true;
#elif defined(_IRR_OSX_PLATFORM_) #elif defined(_IRR_OSX_PLATFORM_)
...@@ -163,7 +164,6 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const ...@@ -163,7 +164,6 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
#else #else
// could probably be read from "/proc/cpuinfo" or "/proc/cpufreq" // could probably be read from "/proc/cpuinfo" or "/proc/cpufreq"
FILE* file = fopen("/proc/cpuinfo", "r"); FILE* file = fopen("/proc/cpuinfo", "r");
*MHz=0;
if (file) if (file)
{ {
char buffer[1024]; char buffer[1024];
...@@ -199,7 +199,6 @@ bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const ...@@ -199,7 +199,6 @@ bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
if (Avail) if (Avail)
*Avail = (u32)(MemoryStatus.dwAvailPhys>>10); *Avail = (u32)(MemoryStatus.dwAvailPhys>>10);
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return true; return true;
#elif defined(_IRR_POSIX_API_) && !defined(__FreeBSD__) #elif defined(_IRR_POSIX_API_) && !defined(__FreeBSD__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment