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

Side by Side Diff: courgette/disassembler_elf_32.cc

Issue 613893002: Fix more MSVC warnings, courgette/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static_cast 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
« no previous file with comments | « courgette/assembly_program.cc ('k') | courgette/disassembler_elf_32_arm.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "courgette/disassembler_elf_32.h" 5 #include "courgette/disassembler_elf_32.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 398 }
399 399
400 // Rest of the section (if any) 400 // Rest of the section (if any)
401 return ParseSimpleRegion(file_offset, section_end, program); 401 return ParseSimpleRegion(file_offset, section_end, program);
402 } 402 }
403 403
404 CheckBool DisassemblerElf32::ParseSimpleRegion( 404 CheckBool DisassemblerElf32::ParseSimpleRegion(
405 size_t start_file_offset, 405 size_t start_file_offset,
406 size_t end_file_offset, 406 size_t end_file_offset,
407 AssemblyProgram* program) { 407 AssemblyProgram* program) {
408 // Callers don't guarantee start < end
409 if (start_file_offset >= end_file_offset) return true;
408 410
409 const uint8* start = OffsetToPointer(start_file_offset); 411 const size_t len = end_file_offset - start_file_offset;
410 const uint8* end = OffsetToPointer(end_file_offset);
411 412
412 // Callers don't guarantee start < end 413 if (!program->EmitBytesInstruction(OffsetToPointer(start_file_offset), len))
413 if (start >= end) return true;
414
415 const ptrdiff_t len = end - start; // Works because vars are byte pointers
416
417 if (!program->EmitBytesInstruction(start, len))
418 return false; 414 return false;
419 415
420 return true; 416 return true;
421 } 417 }
422 418
423 CheckBool DisassemblerElf32::ParseAbs32Relocs() { 419 CheckBool DisassemblerElf32::ParseAbs32Relocs() {
424 abs32_locations_.clear(); 420 abs32_locations_.clear();
425 421
426 // Loop through sections for relocation sections 422 // Loop through sections for relocation sections
427 for (int section_id = 0; section_id < SectionHeaderCount(); section_id++) { 423 for (int section_id = 0; section_id < SectionHeaderCount(); section_id++) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 return false; 493 return false;
498 } 494 }
499 495
500 std::sort(rel32_locations_.begin(), 496 std::sort(rel32_locations_.begin(),
501 rel32_locations_.end(), 497 rel32_locations_.end(),
502 TypedRVA::IsLessThan); 498 TypedRVA::IsLessThan);
503 return true; 499 return true;
504 } 500 }
505 501
506 } // namespace courgette 502 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/assembly_program.cc ('k') | courgette/disassembler_elf_32_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698