OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 &temp.data_5[3], | 81 &temp.data_5[3], |
82 &temp.data_5[4], | 82 &temp.data_5[4], |
83 &temp.data_5[5]); | 83 &temp.data_5[5]); |
84 if (rv != 11) | 84 if (rv != 11) |
85 return false; | 85 return false; |
86 | 86 |
87 *this = temp; | 87 *this = temp; |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
| 91 #if defined(OS_WIN) |
| 92 void UUID::InitializeFromSystemUUID(const ::UUID* system_uuid) { |
| 93 static_assert(sizeof(::UUID) == sizeof(UUID), |
| 94 "unexpected system uuid size"); |
| 95 static_assert(offsetof(::UUID, Data1) == offsetof(UUID, data_1), |
| 96 "unexpected system uuid layout"); |
| 97 memcpy(this, system_uuid, sizeof(::UUID)); |
| 98 } |
| 99 #endif // OS_WIN |
| 100 |
91 std::string UUID::ToString() const { | 101 std::string UUID::ToString() const { |
92 return base::StringPrintf("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", | 102 return base::StringPrintf("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", |
93 data_1, | 103 data_1, |
94 data_2, | 104 data_2, |
95 data_3, | 105 data_3, |
96 data_4[0], | 106 data_4[0], |
97 data_4[1], | 107 data_4[1], |
98 data_5[0], | 108 data_5[0], |
99 data_5[1], | 109 data_5[1], |
100 data_5[2], | 110 data_5[2], |
101 data_5[3], | 111 data_5[3], |
102 data_5[4], | 112 data_5[4], |
103 data_5[5]); | 113 data_5[5]); |
104 } | 114 } |
105 | 115 |
106 #if defined(OS_WIN) | 116 #if defined(OS_WIN) |
107 base::string16 UUID::ToString16() const { | 117 base::string16 UUID::ToString16() const { |
108 return base::UTF8ToUTF16(ToString()); | 118 return base::UTF8ToUTF16(ToString()); |
109 } | 119 } |
110 #endif // OS_WIN | 120 #endif // OS_WIN |
111 | 121 |
112 } // namespace crashpad | 122 } // namespace crashpad |
OLD | NEW |