summaryrefslogtreecommitdiffstats
path: root/base/sys_info_win.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-20 01:16:23 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-20 01:16:23 +0000
commit02ee34a9daa91fd125b9f9a48ca56502c8d1d36c (patch)
tree607ac680d8d8d8b39348d8415677e9813d440737 /base/sys_info_win.cc
parentc328da8db8cb5c8d9366874c6e23533e9fa82c7e (diff)
downloadchromium_src-02ee34a9daa91fd125b9f9a48ca56502c8d1d36c.zip
chromium_src-02ee34a9daa91fd125b9f9a48ca56502c8d1d36c.tar.gz
chromium_src-02ee34a9daa91fd125b9f9a48ca56502c8d1d36c.tar.bz2
Fix AmountOfFreeDiskSpace to be able to differentiate an error
from a full disk. Review URL: http://codereview.chromium.org/4003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/sys_info_win.cc')
-rw-r--r--base/sys_info_win.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc
index a90f7b9..2d3c203 100644
--- a/base/sys_info_win.cc
+++ b/base/sys_info_win.cc
@@ -26,16 +26,22 @@ int64 SysInfo::AmountOfPhysicalMemory() {
return 0;
}
- return static_cast<int64>(memory_info.ullTotalPhys);
+ int64 rv = static_cast<int64>(memory_info.ullTotalPhys);
+ if (rv < 0)
+ rv = kint64max;
+ return rv;
}
// static
int64 SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) {
ULARGE_INTEGER available, total, free;
if (!GetDiskFreeSpaceExW(path.c_str(), &available, &total, &free)) {
- return 0;
+ return -1;
}
- return static_cast<int64>(available.QuadPart);
+ int64 rv = static_cast<int64>(available.QuadPart);
+ if (rv < 0)
+ rv = kint64max;
+ return rv;
}
} // namespace base