Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 { | 34 { |
| 35 static bool initialized = false; | 35 static bool initialized = false; |
| 36 static WindowsVersion version; | 36 static WindowsVersion version; |
| 37 static int majorVersion, minorVersion; | 37 static int majorVersion, minorVersion; |
| 38 | 38 |
| 39 if (!initialized) { | 39 if (!initialized) { |
| 40 initialized = true; | 40 initialized = true; |
| 41 OSVERSIONINFOEX versionInfo; | 41 OSVERSIONINFOEX versionInfo; |
| 42 ZeroMemory(&versionInfo, sizeof(versionInfo)); | 42 ZeroMemory(&versionInfo, sizeof(versionInfo)); |
| 43 versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); | 43 versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); |
| 44 #ifdef _WIN32_WINNT_WINBLUE | |
| 45 // Since Win SDK 8.1, GetVersionEx() is deprecated. | |
| 46 #pragma warning(push) | |
| 47 #pragma warning(disable: 4996) | |
| 48 #endif | |
| 44 GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&versionInfo)); | 49 GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&versionInfo)); |
|
yukawa
2013/10/24 11:35:38
Just FYI, you can also suppress warning only in on
| |
| 50 #ifdef _WIN32_WINNT_WINBLUE | |
| 51 #pragma warning(pop) | |
| 52 #endif | |
| 45 majorVersion = versionInfo.dwMajorVersion; | 53 majorVersion = versionInfo.dwMajorVersion; |
| 46 minorVersion = versionInfo.dwMinorVersion; | 54 minorVersion = versionInfo.dwMinorVersion; |
| 47 | 55 |
| 48 if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32s) { | 56 if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32s) { |
| 49 version = Windows3_1; | 57 version = Windows3_1; |
| 50 } else if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { | 58 } else if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { |
| 51 if (!minorVersion) | 59 if (!minorVersion) |
| 52 version = Windows95; | 60 version = Windows95; |
| 53 else | 61 else |
| 54 version = (minorVersion == 10) ? Windows98 : WindowsME; | 62 version = (minorVersion == 10) ? Windows98 : WindowsME; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 70 } | 78 } |
| 71 | 79 |
| 72 if (major) | 80 if (major) |
| 73 *major = majorVersion; | 81 *major = majorVersion; |
| 74 if (minor) | 82 if (minor) |
| 75 *minor = minorVersion; | 83 *minor = minorVersion; |
| 76 return version; | 84 return version; |
| 77 } | 85 } |
| 78 | 86 |
| 79 } // namespace WebCore | 87 } // namespace WebCore |
| OLD | NEW |