Title: [118035] trunk/Source/WTF
Revision
118035
Author
[email protected]
Date
2012-05-22 13:20:34 -0700 (Tue, 22 May 2012)

Log Message

2012-05-22  Geoffrey Garen  <[email protected]>

        Build fix.

        * wtf/RAMSize.cpp:
        (WTF::computeRAMSize): sysctl expects a uint64_t, so use that and then
        cast back to size_t. Since it's coneivable that a 32bit process would
        run on a system with more than 4GB RAM, I added a paranoid check for
        that condition.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (118034 => 118035)


--- trunk/Source/WTF/ChangeLog	2012-05-22 20:17:20 UTC (rev 118034)
+++ trunk/Source/WTF/ChangeLog	2012-05-22 20:20:34 UTC (rev 118035)
@@ -1,3 +1,13 @@
+2012-05-22  Geoffrey Garen  <[email protected]>
+
+        Build fix.
+
+        * wtf/RAMSize.cpp:
+        (WTF::computeRAMSize): sysctl expects a uint64_t, so use that and then
+        cast back to size_t. Since it's coneivable that a 32bit process would
+        run on a system with more than 4GB RAM, I added a paranoid check for
+        that condition.
+
 2012-05-22  Jessie Berlin  <[email protected]>
 
         Build fix.

Modified: trunk/Source/WTF/wtf/RAMSize.cpp (118034 => 118035)


--- trunk/Source/WTF/wtf/RAMSize.cpp	2012-05-22 20:17:20 UTC (rev 118034)
+++ trunk/Source/WTF/wtf/RAMSize.cpp	2012-05-22 20:20:34 UTC (rev 118035)
@@ -45,7 +45,7 @@
 {
 #if OS(DARWIN)
     int mib[2];
-    size_t ramSize;
+    uint64_t ramSize;
     size_t length;
 
     mib[0] = CTL_HW;
@@ -54,7 +54,7 @@
     int sysctlResult = sysctl(mib, 2, &ramSize, &length, 0, 0);
     if (sysctlResult == -1)
         return ramSizeGuess;
-    return ramSize;
+    return ramSize > std::numeric_limits<size_t>::max() ? std::numeric_limits<size_t>::max() : static_cast<size_t>(ramSize);
 #elif OS(UNIX)
     long pages = sysconf(_SC_PHYS_PAGES);
     long pageSize = sysconf(_SC_PAGE_SIZE);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to