Title: [184490] releases/WebKitGTK/webkit-2.4/Source/WebCore
Revision
184490
Author
[email protected]
Date
2015-05-18 09:47:39 -0700 (Mon, 18 May 2015)

Log Message

[W32] windowsVersion() and osVersionForUAString() are outdated
https://bugs.webkit.org/show_bug.cgi?id=143771

Patch by Руслан Ижбулатов <[email protected]> on 2015-04-15
Reviewed by Darin Adler

Update windowsVersion() and osVersionForUAString()

Add support for newer Windows versions to windowsVersion(), handle
all defined cases in osVersionForUAString(), avoiding warnings like
../webkitgtk-2.4.8/Source/WebCore/platform/win/SystemInfo.cpp: In function 'WTF::String WebCore::osVersionForUAString()':
../webkitgtk-2.4.8/Source/WebCore/platform/win/SystemInfo.cpp:94:12: warning: enumeration value 'WindowsCE5' not handled in switch [-Wswitch]
repeated for each unhandled value

* platform/win/SystemInfo.cpp:
(WebCore::windowsVersion):
(WebCore::osVersionForUAString):
* platform/win/SystemInfo.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (184489 => 184490)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2015-05-18 16:17:06 UTC (rev 184489)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2015-05-18 16:47:39 UTC (rev 184490)
@@ -1,3 +1,23 @@
+2015-04-15  Руслан Ижбулатов  <[email protected]>
+
+        [W32] windowsVersion() and osVersionForUAString() are outdated
+        https://bugs.webkit.org/show_bug.cgi?id=143771
+
+        Reviewed by Darin Adler
+
+        Update windowsVersion() and osVersionForUAString()
+
+        Add support for newer Windows versions to windowsVersion(), handle
+        all defined cases in osVersionForUAString(), avoiding warnings like
+        ../webkitgtk-2.4.8/Source/WebCore/platform/win/SystemInfo.cpp: In function 'WTF::String WebCore::osVersionForUAString()':
+        ../webkitgtk-2.4.8/Source/WebCore/platform/win/SystemInfo.cpp:94:12: warning: enumeration value 'WindowsCE5' not handled in switch [-Wswitch]
+        repeated for each unhandled value
+
+        * platform/win/SystemInfo.cpp:
+        (WebCore::windowsVersion):
+        (WebCore::osVersionForUAString):
+        * platform/win/SystemInfo.h:
+
 2015-04-17  Milan Crha  <[email protected]>
 
         [GTK] Replace M_SQRT2 with sqrtOfTwoDouble

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/win/SystemInfo.cpp (184489 => 184490)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/win/SystemInfo.cpp	2015-05-18 16:17:06 UTC (rev 184489)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/win/SystemInfo.cpp	2015-05-18 16:47:39 UTC (rev 184490)
@@ -29,6 +29,10 @@
 #include <windows.h>
 #include <wtf/text/WTFString.h>
 
+#ifndef SM_SERVERR2
+#define SM_SERVERR2 89
+#endif
+
 namespace WebCore {
 
 WindowsVersion windowsVersion(int* major, int* minor)
@@ -65,15 +69,75 @@
                 version = (minorVersion == 10) ? Windows98 : WindowsME;
         } else {
             if (majorVersion == 5) {
-                if (!minorVersion)
+                switch (minorVersion) {
+                default:
+                case 0:
                     version = Windows2000;
-                else
-                    version = (minorVersion == 1) ? WindowsXP : WindowsServer2003;
-            } else if (majorVersion >= 6) {
-                if (versionInfo.wProductType == VER_NT_WORKSTATION)
-                    version = (majorVersion == 6 && !minorVersion) ? WindowsVista : Windows7;
-                else
-                    version = WindowsServer2008;
+                    break;
+                case 1:
+                    version = WindowsXP;
+                    break;
+                case 2:
+                    if (versionInfo.wProductType == VER_NT_WORKSTATION)
+                        version = WindowsXP64;
+                    else {
+                        if (!GetSystemMetrics(SM_SERVERR2))
+                            version = WindowsServer2003;
+                        else
+                            version = WindowsServer2003R2;
+                    }
+                    break;
+                }
+            } else if (majorVersion == 6) {
+                if (versionInfo.wProductType == VER_NT_WORKSTATION) {
+                    switch (minorVersion) {
+                    default:
+                    case 0:
+                        version = WindowsVista;
+                        break;
+                    case 1:
+                        version = Windows7;
+                        break;
+                    case 2:
+                        version = Windows8;
+                        break;
+                    case 3:
+                        version = Windows81;
+                        break;
+                    }
+                } else {
+                    switch (minorVersion) {
+                    default:
+                    case 0:
+                        version = WindowsServer2008;
+                        break;
+                    case 1:
+                        version = WindowsServer2008R2;
+                        break;
+                    case 2:
+                        version = WindowsServer2012;
+                        break;
+                    case 3:
+                        version = WindowsServer2012R2;
+                        break;
+                    }
+                }
+            } else if (majorVersion == 10) {
+                if (versionInfo.wProductType == VER_NT_WORKSTATION) {
+                    switch (minorVersion) {
+                    default:
+                    case 0:
+                        version = Windows10;
+                        break;
+                    }
+                } else {
+                    switch (minorVersion) {
+                    default:
+                    case 0:
+                        version = WindowsServer2016;
+                        break;
+                    }
+                }
             } else
                 version = (majorVersion == 4) ? WindowsNT4 : WindowsNT3;
         }
@@ -97,6 +161,9 @@
     case WindowsCE3:
         return "Windows CE";
     case WindowsCE4:
+    case WindowsCE5:
+    case WindowsCE6:
+    case WindowsCE7:
         return "Windows CE .NET";
     case Windows3_1:
         return "Windows 3.1";
@@ -106,8 +173,40 @@
         return "Windows 98";
     case WindowsME:
         return "Windows 98; Win 9x 4.90";
+    case WindowsNT3:
+        return "WinNT3.0";
     case WindowsNT4:
         return "WinNT4.0";
+    case Windows2000:
+        return "Windows 2000";
+    case WindowsXP:
+        return "Windows XP";
+    case WindowsServer2003:
+        return "Windows Server 2003";
+    case WindowsXP64:
+        return "Windows XP Professional x64 Edition";
+    case WindowsServer2003R2:
+        return "Windows Server 2003 R2";
+    case WindowsVista:
+        return "Windows Vista";
+    case WindowsServer2008:
+        return "Windows Server 2008";
+    case Windows7:
+        return "Windows 7";
+    case WindowsServer2008R2:
+        return "Windows Server 2008 R2";
+    case Windows8:
+        return "Windows 8";
+    case WindowsServer2012:
+        return "Windows Server 2012";
+    case Windows81:
+        return "Windows 8.1";
+    case WindowsServer2012R2:
+        return "Windows Server 2012 R2";
+    case Windows10:
+        return "Windows 10";
+    case WindowsServer2016:
+        return "Windows Server 2016";
     }
 
     const char* familyName = (version >= WindowsNT3) ? "Windows NT " : "Windows CE ";

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/win/SystemInfo.h (184489 => 184490)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/win/SystemInfo.h	2015-05-18 16:17:06 UTC (rev 184489)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/win/SystemInfo.h	2015-05-18 16:47:39 UTC (rev 184490)
@@ -54,9 +54,18 @@
     Windows2000,
     WindowsXP,
     WindowsServer2003,
+    WindowsXP64,
+    WindowsServer2003R2,
     WindowsVista,
     WindowsServer2008,
     Windows7,
+    WindowsServer2008R2,
+    Windows8,
+    WindowsServer2012,
+    Windows81,
+    WindowsServer2012R2,
+    Windows10,
+    WindowsServer2016,
 };
 
 // If supplied, |major| and |minor| are set to the OSVERSIONINFO::dwMajorVersion
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to