always deal with memory measures as ulonglong, this way systems with >4 GB of memory work for real now

svn path=/trunk/KDE/kdegraphics/okular/; revision=867871
This commit is contained in:
Pino Toscano 2008-10-04 19:31:36 +00:00
parent f1f52f4124
commit 27e703f878

View file

@ -228,7 +228,7 @@ qulonglong DocumentPrivate::getTotalMemory()
QString entry = readStream.readLine();
if ( entry.isNull() ) break;
if ( entry.startsWith( "MemTotal:" ) )
return (cachedValue = (1024 * entry.section( ' ', -2, -2 ).toInt()));
return (cachedValue = (Q_UINT64_C(1024) * entry.section( ' ', -2, -2 ).toULongLong()));
}
#elif defined(Q_OS_WIN)
MEMORYSTATUSEX stat;
@ -267,15 +267,15 @@ qulonglong DocumentPrivate::getFreeMemory()
entry.startsWith( "Buffers:" ) ||
entry.startsWith( "Cached:" ) ||
entry.startsWith( "SwapFree:" ) )
memoryFree += entry.section( ' ', -2, -2 ).toInt();
memoryFree += entry.section( ' ', -2, -2 ).toULongLong();
if ( entry.startsWith( "SwapTotal:" ) )
memoryFree -= entry.section( ' ', -2, -2 ).toInt();
memoryFree -= entry.section( ' ', -2, -2 ).toULongLong();
}
memFile.close();
lastUpdate = QTime::currentTime();
return ( cachedValue = (1024 * memoryFree) );
return ( cachedValue = (Q_UINT64_C(1024) * memoryFree) );
#elif defined(Q_OS_WIN)
MEMORYSTATUSEX stat;