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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return nullptr; | 152 return nullptr; |
153 } | 153 } |
154 | 154 |
155 return header; | 155 return header; |
156 } | 156 } |
157 | 157 |
158 namespace { | 158 namespace { |
159 | 159 |
160 struct MinidumpMemoryListTraits { | 160 struct MinidumpMemoryListTraits { |
161 using ListType = MINIDUMP_MEMORY_LIST; | 161 using ListType = MINIDUMP_MEMORY_LIST; |
162 static constexpr size_t kElementSize = sizeof(MINIDUMP_MEMORY_DESCRIPTOR); | 162 enum : size_t { kElementSize = sizeof(MINIDUMP_MEMORY_DESCRIPTOR) }; |
163 static size_t ElementCount(const ListType* list) { | 163 static size_t ElementCount(const ListType* list) { |
164 return list->NumberOfMemoryRanges; | 164 return list->NumberOfMemoryRanges; |
165 } | 165 } |
166 }; | 166 }; |
167 | 167 |
168 struct MinidumpModuleListTraits { | 168 struct MinidumpModuleListTraits { |
169 using ListType = MINIDUMP_MODULE_LIST; | 169 using ListType = MINIDUMP_MODULE_LIST; |
170 static constexpr size_t kElementSize = sizeof(MINIDUMP_MODULE); | 170 enum : size_t { kElementSize = sizeof(MINIDUMP_MODULE) }; |
171 static size_t ElementCount(const ListType* list) { | 171 static size_t ElementCount(const ListType* list) { |
172 return list->NumberOfModules; | 172 return list->NumberOfModules; |
173 } | 173 } |
174 }; | 174 }; |
175 | 175 |
176 struct MinidumpThreadListTraits { | 176 struct MinidumpThreadListTraits { |
177 using ListType = MINIDUMP_THREAD_LIST; | 177 using ListType = MINIDUMP_THREAD_LIST; |
178 static constexpr size_t kElementSize = sizeof(MINIDUMP_THREAD); | 178 enum : size_t { kElementSize = sizeof(MINIDUMP_THREAD) }; |
179 static size_t ElementCount(const ListType* list) { | 179 static size_t ElementCount(const ListType* list) { |
180 return list->NumberOfThreads; | 180 return list->NumberOfThreads; |
181 } | 181 } |
182 }; | 182 }; |
183 | 183 |
184 struct MinidumpLocationDescriptorListTraits { | 184 struct MinidumpLocationDescriptorListTraits { |
185 using ListType = MinidumpLocationDescriptorList; | 185 using ListType = MinidumpLocationDescriptorList; |
186 static constexpr size_t kElementSize = sizeof(MINIDUMP_LOCATION_DESCRIPTOR); | 186 enum : size_t { kElementSize = sizeof(MINIDUMP_LOCATION_DESCRIPTOR) }; |
187 static size_t ElementCount(const ListType* list) { | 187 static size_t ElementCount(const ListType* list) { |
188 return list->count; | 188 return list->count; |
189 } | 189 } |
190 }; | 190 }; |
191 | 191 |
192 struct MinidumpSimpleStringDictionaryListTraits { | 192 struct MinidumpSimpleStringDictionaryListTraits { |
193 using ListType = MinidumpSimpleStringDictionary; | 193 using ListType = MinidumpSimpleStringDictionary; |
194 static constexpr size_t kElementSize = | 194 enum : size_t { kElementSize = sizeof(MinidumpSimpleStringDictionaryEntry) }; |
195 sizeof(MinidumpSimpleStringDictionaryEntry); | |
196 static size_t ElementCount(const ListType* list) { | 195 static size_t ElementCount(const ListType* list) { |
197 return list->count; | 196 return list->count; |
198 } | 197 } |
199 }; | 198 }; |
200 | 199 |
201 template <typename T> | 200 template <typename T> |
202 const typename T::ListType* MinidumpListAtLocationDescriptor( | 201 const typename T::ListType* MinidumpListAtLocationDescriptor( |
203 const std::string& file_contents, | 202 const std::string& file_contents, |
204 const MINIDUMP_LOCATION_DESCRIPTOR& location) { | 203 const MINIDUMP_LOCATION_DESCRIPTOR& location) { |
205 const typename T::ListType* list = | 204 const typename T::ListType* list = |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 size_t TestUInt32MinidumpWritable::SizeOfObject() { | 319 size_t TestUInt32MinidumpWritable::SizeOfObject() { |
321 return sizeof(value_); | 320 return sizeof(value_); |
322 } | 321 } |
323 | 322 |
324 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { | 323 bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { |
325 return file_writer->Write(&value_, sizeof(value_)); | 324 return file_writer->Write(&value_, sizeof(value_)); |
326 } | 325 } |
327 | 326 |
328 } // namespace test | 327 } // namespace test |
329 } // namespace crashpad | 328 } // namespace crashpad |
OLD | NEW |