Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: util/misc/uuid.cc

Issue 440603002: Put back the standard-layout checks lost in 5bbb7e8abbe0 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/misc/uuid.h ('k') | util/misc/uuid_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "util/misc/uuid.h" 15 #include "util/misc/uuid.h"
16 16
17 #include <string.h> 17 #include <string.h>
18 18
19 #include "base/basictypes.h" 19 #include "base/basictypes.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
21 #include "base/sys_byteorder.h" 21 #include "base/sys_byteorder.h"
22 #include "util/stdlib/cxx.h"
23
24 #if CXX_LIBRARY_VERSION >= 2011
25 #include <type_traits>
26 #endif
22 27
23 namespace crashpad { 28 namespace crashpad {
24 29
30 COMPILE_ASSERT(sizeof(UUID) == 16, UUID_must_be_16_bytes);
31
32 #if CXX_LIBRARY_VERSION >= 2011
33 COMPILE_ASSERT(std::is_standard_layout<UUID>::value,
34 UUID_must_be_standard_layout);
35 #endif
36
25 UUID::UUID() : data_1(0), data_2(0), data_3(0), data_4(), data_5() { 37 UUID::UUID() : data_1(0), data_2(0), data_3(0), data_4(), data_5() {
26 } 38 }
27 39
28 UUID::UUID(const uint8_t* bytes) { 40 UUID::UUID(const uint8_t* bytes) {
29 InitializeFromBytes(bytes); 41 InitializeFromBytes(bytes);
30 } 42 }
31 43
32 void UUID::InitializeFromBytes(const uint8_t* bytes) { 44 void UUID::InitializeFromBytes(const uint8_t* bytes) {
33 memcpy(this, bytes, sizeof(*this)); 45 memcpy(this, bytes, sizeof(*this));
34 data_1 = base::NetToHost32(data_1); 46 data_1 = base::NetToHost32(data_1);
(...skipping 10 matching lines...) Expand all
45 data_4[1], 57 data_4[1],
46 data_5[0], 58 data_5[0],
47 data_5[1], 59 data_5[1],
48 data_5[2], 60 data_5[2],
49 data_5[3], 61 data_5[3],
50 data_5[4], 62 data_5[4],
51 data_5[5]); 63 data_5[5]);
52 } 64 }
53 65
54 } // namespace crashpad 66 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/misc/uuid.h ('k') | util/misc/uuid_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698