OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } else { | 65 } else { |
66 ss.str(""); | 66 ss.str(""); |
67 ss << "0x" << std::hex << fc; | 67 ss << "0x" << std::hex << fc; |
68 } | 68 } |
69 out->append(ss.str()); | 69 out->append(ss.str()); |
70 } | 70 } |
71 | 71 |
72 static bool GetGestalt(OSType ostype, int* value) { | 72 static bool GetGestalt(OSType ostype, int* value) { |
73 ASSERT(NULL != value); | 73 ASSERT(NULL != value); |
74 SInt32 native_value; | 74 SInt32 native_value; |
| 75 // TODO(hjon): Update deprecated APIs (see webrtc:5478 for details). |
| 76 #pragma clang diagnostic push |
| 77 #pragma clang diagnostic ignored "-Wdeprecated" |
75 OSStatus result = Gestalt(ostype, &native_value); | 78 OSStatus result = Gestalt(ostype, &native_value); |
| 79 #pragma clang diagnostic pop |
76 if (noErr == result) { | 80 if (noErr == result) { |
77 *value = native_value; | 81 *value = native_value; |
78 return true; | 82 return true; |
79 } | 83 } |
80 std::string str; | 84 std::string str; |
81 DecodeFourChar(ostype, &str); | 85 DecodeFourChar(ostype, &str); |
82 LOG_E(LS_ERROR, OS, result) << "Gestalt(" << str << ")"; | 86 LOG_E(LS_ERROR, OS, result) << "Gestalt(" << str << ")"; |
83 return false; | 87 return false; |
84 } | 88 } |
85 | 89 |
86 bool GetOSVersion(int* major, int* minor, int* bugfix) { | 90 bool GetOSVersion(int* major, int* minor, int* bugfix) { |
87 ASSERT(major && minor && bugfix); | 91 ASSERT(major && minor && bugfix); |
| 92 // TODO(hjon): Update deprecated APIs (see webrtc:5478 for details). |
| 93 #pragma clang diagnostic push |
| 94 #pragma clang diagnostic ignored "-Wdeprecated" |
88 if (!GetGestalt(gestaltSystemVersion, major)) { | 95 if (!GetGestalt(gestaltSystemVersion, major)) { |
89 return false; | 96 return false; |
90 } | 97 } |
91 if (*major < 0x1040) { | 98 if (*major < 0x1040) { |
92 *bugfix = *major & 0xF; | 99 *bugfix = *major & 0xF; |
93 *minor = (*major >> 4) & 0xF; | 100 *minor = (*major >> 4) & 0xF; |
94 *major = (*major >> 8); | 101 *major = (*major >> 8); |
95 return true; | 102 return true; |
96 } | 103 } |
97 return GetGestalt(gestaltSystemVersionMajor, major) && | 104 return GetGestalt(gestaltSystemVersionMajor, major) && |
98 GetGestalt(gestaltSystemVersionMinor, minor) && | 105 GetGestalt(gestaltSystemVersionMinor, minor) && |
99 GetGestalt(gestaltSystemVersionBugFix, bugfix); | 106 GetGestalt(gestaltSystemVersionBugFix, bugfix); |
| 107 #pragma clang diagnostic pop |
100 } | 108 } |
101 | 109 |
102 MacOSVersionName GetOSVersionName() { | 110 MacOSVersionName GetOSVersionName() { |
103 int major = 0, minor = 0, bugfix = 0; | 111 int major = 0, minor = 0, bugfix = 0; |
104 if (!GetOSVersion(&major, &minor, &bugfix)) { | 112 if (!GetOSVersion(&major, &minor, &bugfix)) { |
105 return kMacOSUnknown; | 113 return kMacOSUnknown; |
106 } | 114 } |
107 if (major > 10) { | 115 if (major > 10) { |
108 return kMacOSNewer; | 116 return kMacOSNewer; |
109 } | 117 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 #else | 220 #else |
213 // TODO(thaloun): Support applescripts with the NSAppleScript API. | 221 // TODO(thaloun): Support applescripts with the NSAppleScript API. |
214 return false; | 222 return false; |
215 #endif // CARBON_DEPRECATED | 223 #endif // CARBON_DEPRECATED |
216 } | 224 } |
217 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) | 225 #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) |
218 | 226 |
219 /////////////////////////////////////////////////////////////////////////////// | 227 /////////////////////////////////////////////////////////////////////////////// |
220 | 228 |
221 } // namespace rtc | 229 } // namespace rtc |
OLD | NEW |