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

Side by Side Diff: snapshot/mac/process_types.cc

Issue 700143004: C++11: Use type aliases instead of typedefs (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 1 month 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 | « snapshot/mac/process_types.h ('k') | snapshot/mac/process_types/traits.h » ('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,
(...skipping 25 matching lines...) Expand all
36 36
37 template <> 37 template <>
38 inline void Assign<process_types::internal::Reserved64Only64, 38 inline void Assign<process_types::internal::Reserved64Only64,
39 process_types::internal::Reserved64Only32>( 39 process_types::internal::Reserved64Only32>(
40 process_types::internal::Reserved64Only64* destination, 40 process_types::internal::Reserved64Only64* destination,
41 const process_types::internal::Reserved64Only32& source) { 41 const process_types::internal::Reserved64Only32& source) {
42 // Reserved64Only32 carries no data. 42 // Reserved64Only32 carries no data.
43 *destination = 0; 43 *destination = 0;
44 } 44 }
45 45
46 typedef char CharArray16[16]; 46 using CharArray16 = char[16];
47 template <> 47 template <>
48 inline void Assign<CharArray16, CharArray16>(CharArray16* destination, 48 inline void Assign<CharArray16, CharArray16>(CharArray16* destination,
49 const CharArray16& source) { 49 const CharArray16& source) {
50 memcpy(destination, &source, sizeof(source)); 50 memcpy(destination, &source, sizeof(source));
51 } 51 }
52 52
53 typedef uint64_t UInt64Array16[16]; 53 using UInt64Array16 = uint64_t[16];
54 template <> 54 template <>
55 inline void Assign<UInt64Array16, UInt64Array16>(UInt64Array16* destination, 55 inline void Assign<UInt64Array16, UInt64Array16>(UInt64Array16* destination,
56 const UInt64Array16& source) { 56 const UInt64Array16& source) {
57 memcpy(destination, &source, sizeof(source)); 57 memcpy(destination, &source, sizeof(source));
58 } 58 }
59 59
60 typedef uint32_t UInt32Array16[16]; 60 using UInt32Array16 = uint32_t[16];
61 template <> 61 template <>
62 inline void Assign<UInt64Array16, UInt32Array16>(UInt64Array16* destination, 62 inline void Assign<UInt64Array16, UInt32Array16>(UInt64Array16* destination,
63 const UInt32Array16& source) { 63 const UInt32Array16& source) {
64 for (size_t index = 0; index < arraysize(source); ++index) { 64 for (size_t index = 0; index < arraysize(source); ++index) {
65 (*destination)[index] = source[index]; 65 (*destination)[index] = source[index];
66 } 66 }
67 } 67 }
68 68
69 template <> 69 template <>
70 inline void Assign<uuid_t, uuid_t>(uuid_t* destination, const uuid_t& source) { 70 inline void Assign<uuid_t, uuid_t>(uuid_t* destination, const uuid_t& source) {
71 // uuid_t is a typedef for unsigned char[16]. 71 // uuid_t is a type alias for unsigned char[16].
72 memcpy(destination, &source, sizeof(source)); 72 memcpy(destination, &source, sizeof(source));
73 } 73 }
74 74
75 } // namespace 75 } // namespace
76 } // namespace crashpad 76 } // namespace crashpad
77 77
78 // Implement the generic crashpad::process_types::struct_name ReadInto(), which 78 // Implement the generic crashpad::process_types::struct_name ReadInto(), which
79 // delegates to the templatized ReadIntoInternal(), which reads the specific 79 // delegates to the templatized ReadIntoInternal(), which reads the specific
80 // struct type from the remote process and genericizes it. Also implement 80 // struct type from the remote process and genericizes it. Also implement
81 // crashpad::process_types::internal::struct_name<> GenericizeInto(), which 81 // crashpad::process_types::internal::struct_name<> GenericizeInto(), which
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 #define PROCESS_TYPE_STRUCT_MEMBER(member_type, member_name, ...) 235 #define PROCESS_TYPE_STRUCT_MEMBER(member_type, member_name, ...)
236 236
237 #define PROCESS_TYPE_STRUCT_END(struct_name) 237 #define PROCESS_TYPE_STRUCT_END(struct_name)
238 238
239 #include "snapshot/mac/process_types/all.proctype" 239 #include "snapshot/mac/process_types/all.proctype"
240 240
241 #undef PROCESS_TYPE_STRUCT_BEGIN 241 #undef PROCESS_TYPE_STRUCT_BEGIN
242 #undef PROCESS_TYPE_STRUCT_MEMBER 242 #undef PROCESS_TYPE_STRUCT_MEMBER
243 #undef PROCESS_TYPE_STRUCT_END 243 #undef PROCESS_TYPE_STRUCT_END
244 #undef PROCESS_TYPE_STRUCT_IMPLEMENT_ARRAY 244 #undef PROCESS_TYPE_STRUCT_IMPLEMENT_ARRAY
OLDNEW
« no previous file with comments | « snapshot/mac/process_types.h ('k') | snapshot/mac/process_types/traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698