| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/sys_info.h" | 5 #include "base/sys_info.h" |
| 6 | 6 |
| 7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 | 10 |
| 11 // static | 11 // static |
| 12 void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, | 12 void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, |
| 13 int32 *minor_version, | 13 int32 *minor_version, |
| 14 int32 *bugfix_version) { | 14 int32 *bugfix_version) { |
| 15 int32 major_version_cached = 0; | |
| 16 int32 minor_version_cached = 0; | |
| 17 int32 bugfix_version_cached = 0; | |
| 18 | |
| 19 // Gestalt can't be called in the sandbox, so we cache its return value. | |
| 20 Gestalt(gestaltSystemVersionMajor, | 15 Gestalt(gestaltSystemVersionMajor, |
| 21 reinterpret_cast<SInt32*>(&major_version_cached)); | 16 reinterpret_cast<SInt32*>(major_version)); |
| 22 Gestalt(gestaltSystemVersionMinor, | 17 Gestalt(gestaltSystemVersionMinor, |
| 23 reinterpret_cast<SInt32*>(&minor_version_cached)); | 18 reinterpret_cast<SInt32*>(minor_version)); |
| 24 Gestalt(gestaltSystemVersionBugFix, | 19 Gestalt(gestaltSystemVersionBugFix, |
| 25 reinterpret_cast<SInt32*>(&bugfix_version_cached)); | 20 reinterpret_cast<SInt32*>(bugfix_version)); |
| 26 | |
| 27 *major_version = major_version_cached; | |
| 28 *minor_version = minor_version_cached; | |
| 29 *bugfix_version = bugfix_version_cached; | |
| 30 } | 21 } |
| 31 | 22 |
| 32 } // namespace base | 23 } // namespace base |
| OLD | NEW |