Chromium Code Reviews| Index: courgette/disassembler_elf_32.h |
| diff --git a/courgette/disassembler_elf_32.h b/courgette/disassembler_elf_32.h |
| index 8793106957283890b19a70da4ba061410f4d6478..ee6e6704982644aee41065ef7d022618f2271019 100644 |
| --- a/courgette/disassembler_elf_32.h |
| +++ b/courgette/disassembler_elf_32.h |
| @@ -8,10 +8,10 @@ |
| #include <stddef.h> |
| #include <stdint.h> |
| +#include <memory> |
| #include <vector> |
| #include "base/macros.h" |
| -#include "base/memory/scoped_vector.h" |
| #include "courgette/disassembler.h" |
| #include "courgette/image_utils.h" |
| #include "courgette/memory_allocator.h" |
| @@ -61,12 +61,14 @@ class DisassemblerElf32 : public Disassembler { |
| virtual uint16_t op_size() const = 0; |
| // Comparator for sorting, which assumes uniqueness of RVAs. |
| - static bool IsLessThanByRVA(TypedRVA* a, TypedRVA* b) { |
| + static bool IsLessThanByRVA(const std::unique_ptr<TypedRVA>& a, |
| + const std::unique_ptr<TypedRVA>& b) { |
|
huangs
2016/05/11 04:49:23
NIT: Align to "(" like
function_name(int param1,
etiennep
2016/05/11 18:19:13
Done.
|
| return a->rva() < b->rva(); |
| } |
| // Comparator for sorting, which assumes uniqueness of file offsets. |
| - static bool IsLessThanByFileOffset(TypedRVA* a, TypedRVA* b) { |
| + static bool IsLessThanByFileOffset(const std::unique_ptr<TypedRVA>& a, |
| + const std::unique_ptr<TypedRVA>& b) { |
|
huangs
2016/05/11 04:49:23
Same as above.
etiennep
2016/05/11 18:19:13
Done.
|
| return a->file_offset() < b->file_offset(); |
| } |
| @@ -93,7 +95,9 @@ class DisassemblerElf32 : public Disassembler { |
| // Public for unittests only |
| std::vector<RVA> &Abs32Locations() { return abs32_locations_; } |
|
huangs
2016/05/11 04:49:23
Please group '&' with type (fixes earlier mistake)
etiennep
2016/05/11 18:19:12
Done.
|
| - ScopedVector<TypedRVA> &Rel32Locations() { return rel32_locations_; } |
| + std::vector<std::unique_ptr<TypedRVA>> &Rel32Locations() { |
| + return rel32_locations_; |
| + } |
| protected: |
| bool UpdateLength(); |
| @@ -139,7 +143,8 @@ class DisassemblerElf32 : public Disassembler { |
| CheckBool RVAsToFileOffsets(const std::vector<RVA>& rvas, |
| std::vector<FileOffset>* file_offsets); |
| - CheckBool RVAsToFileOffsets(ScopedVector<TypedRVA>* typed_rvas); |
| + CheckBool RVAsToFileOffsets( |
| + std::vector<std::unique_ptr<TypedRVA>>* typed_rvas); |
| // Parsing code for Disassemble(). |
| @@ -156,8 +161,8 @@ class DisassemblerElf32 : public Disassembler { |
| const Elf32_Shdr* section_header, |
| std::vector<FileOffset>::iterator* current_abs_offset, |
| std::vector<FileOffset>::iterator end_abs_offset, |
| - ScopedVector<TypedRVA>::iterator* current_rel, |
| - ScopedVector<TypedRVA>::iterator end_rel, |
| + std::vector<std::unique_ptr<TypedRVA>>::iterator* current_rel, |
| + std::vector<std::unique_ptr<TypedRVA>>::iterator end_rel, |
| AssemblyProgram* program) WARN_UNUSED_RESULT; |
| CheckBool ParseSimpleRegion(FileOffset start_file_offset, |
| @@ -189,7 +194,7 @@ class DisassemblerElf32 : public Disassembler { |
| size_t default_string_section_size_; |
| std::vector<RVA> abs32_locations_; |
| - ScopedVector<TypedRVA> rel32_locations_; |
| + std::vector<std::unique_ptr<TypedRVA>> rel32_locations_; |
| DISALLOW_COPY_AND_ASSIGN(DisassemblerElf32); |
| }; |