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

Side by Side Diff: util/mac/mach_o_image_segment_reader.cc

Issue 615923004: Convert COMPILE_ASSERT to static_assert (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 2 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
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 segment_command_.vmsize != 0 && 230 segment_command_.vmsize != 0 &&
231 (segment_command_.initprot & VM_PROT_ALL) == VM_PROT_NONE && 231 (segment_command_.initprot & VM_PROT_ALL) == VM_PROT_NONE &&
232 (segment_command_.maxprot & VM_PROT_ALL) == VM_PROT_NONE); 232 (segment_command_.maxprot & VM_PROT_ALL) == VM_PROT_NONE);
233 } 233 }
234 234
235 // static 235 // static
236 std::string MachOImageSegmentReader::SegmentNameString( 236 std::string MachOImageSegmentReader::SegmentNameString(
237 const char* segment_name_c) { 237 const char* segment_name_c) {
238 // This is used to interpret the segname field of both the segment_command and 238 // This is used to interpret the segname field of both the segment_command and
239 // section structures, so be sure that they’re identical. 239 // section structures, so be sure that they’re identical.
240 COMPILE_ASSERT(sizeof(process_types::segment_command::segname) == 240 static_assert(sizeof(process_types::segment_command::segname) ==
241 sizeof(process_types::section::segname), 241 sizeof(process_types::section::segname),
242 sizes_must_be_equal); 242 "sizes must be equal");
243 243
244 return SizeLimitedCString(segment_name_c, 244 return SizeLimitedCString(segment_name_c,
245 sizeof(process_types::segment_command::segname)); 245 sizeof(process_types::segment_command::segname));
246 } 246 }
247 247
248 // static 248 // static
249 std::string MachOImageSegmentReader::SectionNameString( 249 std::string MachOImageSegmentReader::SectionNameString(
250 const char* section_name_c) { 250 const char* section_name_c) {
251 return SizeLimitedCString(section_name_c, 251 return SizeLimitedCString(section_name_c,
252 sizeof(process_types::section::sectname)); 252 sizeof(process_types::section::sectname));
(...skipping 13 matching lines...) Expand all
266 } 266 }
267 267
268 void MachOImageSegmentReader::SetSlide(mach_vm_size_t slide) { 268 void MachOImageSegmentReader::SetSlide(mach_vm_size_t slide) {
269 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 269 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
270 INITIALIZATION_STATE_SET_INITIALIZING(initialized_slide_); 270 INITIALIZATION_STATE_SET_INITIALIZING(initialized_slide_);
271 slide_ = slide; 271 slide_ = slide;
272 INITIALIZATION_STATE_SET_VALID(initialized_slide_); 272 INITIALIZATION_STATE_SET_VALID(initialized_slide_);
273 } 273 }
274 274
275 } // namespace crashpad 275 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698