diff options
author | pkasting <pkasting@chromium.org> | 2014-10-03 11:52:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-03 18:52:42 +0000 |
commit | 8e3a26aaf2392d784ba6d5cbb696da926230a722 (patch) | |
tree | c6556382e51d205e9d704072e8b07c007d8bc651 /courgette/assembly_program.cc | |
parent | 1bd4f75c6522dc81b8ba30ca4174e2c312c43d83 (diff) | |
download | chromium_src-8e3a26aaf2392d784ba6d5cbb696da926230a722.zip chromium_src-8e3a26aaf2392d784ba6d5cbb696da926230a722.tar.gz chromium_src-8e3a26aaf2392d784ba6d5cbb696da926230a722.tar.bz2 |
Fix more MSVC warnings, courgette/ edition.
This is mostly about changing types and inserting casts so as to avoid implicit
value truncations.
BUG=81439
TEST=none
Review URL: https://codereview.chromium.org/613893002
Cr-Commit-Position: refs/heads/master@{#298069}
Diffstat (limited to 'courgette/assembly_program.cc')
-rw-r--r-- | courgette/assembly_program.cc | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/courgette/assembly_program.cc b/courgette/assembly_program.cc index bfdf6ef..4718cbf 100644 --- a/courgette/assembly_program.cc +++ b/courgette/assembly_program.cc @@ -90,16 +90,16 @@ class ByteInstruction : public Instruction { // Emits a single byte. class BytesInstruction : public Instruction { public: - BytesInstruction(const uint8* values, uint32 len) + BytesInstruction(const uint8* values, size_t len) : Instruction(DEFBYTES, 0), values_(values), len_(len) {} const uint8* byte_values() const { return values_; } - uint32 len() const { return len_; } + size_t len() const { return len_; } private: const uint8* values_; - uint32 len_; + size_t len_; }; // A ABS32 to REL32 instruction emits a reference to a label's address. @@ -179,7 +179,7 @@ CheckBool AssemblyProgram::EmitByteInstruction(uint8 byte) { } CheckBool AssemblyProgram::EmitBytesInstruction(const uint8* values, - uint32 len) { + size_t len) { return Emit(new(std::nothrow) BytesInstruction(values, len)); } @@ -421,7 +421,7 @@ EncodedProgram* AssemblyProgram::Encode() const { case DEFBYTES: { const uint8* byte_values = static_cast<BytesInstruction*>(instruction)->byte_values(); - uint32 len = static_cast<BytesInstruction*>(instruction)->len(); + size_t len = static_cast<BytesInstruction*>(instruction)->len(); if (!encoded->AddCopy(len, byte_values)) return NULL; @@ -547,19 +547,6 @@ CheckBool AssemblyProgram::TrimLabels() { return true; } -void AssemblyProgram::PrintLabelCounts(RVAToLabel* labels) { - for (RVAToLabel::const_iterator p = labels->begin(); p != labels->end(); - ++p) { - Label* current = p->second; - if (current->index_ != Label::kNoIndex) - printf("%d\n", current->count_); - } -} - -void AssemblyProgram::CountRel32ARM() { - PrintLabelCounts(&rel32_labels_); -} - //////////////////////////////////////////////////////////////////////////////// Status TrimLabels(AssemblyProgram* program) { |