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

Side by Side Diff: courgette/disassembler_win32_x64.cc

Issue 613893002: Fix more MSVC warnings, courgette/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@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 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_win32_x64.h" 5 #include "courgette/disassembler_win32_x64.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 p += relocs_size; 566 p += relocs_size;
567 continue; 567 continue;
568 } 568 }
569 } 569 }
570 570
571 while (abs32_pos != abs32_locations_.end() && *abs32_pos < current_rva) 571 while (abs32_pos != abs32_locations_.end() && *abs32_pos < current_rva)
572 ++abs32_pos; 572 ++abs32_pos;
573 573
574 if (abs32_pos != abs32_locations_.end() && *abs32_pos == current_rva) { 574 if (abs32_pos != abs32_locations_.end() && *abs32_pos == current_rva) {
575 uint32 target_address = Read32LittleEndian(p); 575 uint32 target_address = Read32LittleEndian(p);
576 RVA target_rva = target_address - image_base(); 576 // !!! Is this cast safe?
Peter Kasting 2014/09/30 00:08:01 This question must be answered before this change
dgarrett 2014/10/01 20:49:37 There were repeated assurances that it is safe for
Peter Kasting 2014/10/01 22:12:05 OK. I implemented this by way of a checked_cast<>
577 RVA target_rva = target_address - static_cast<uint32>(image_base());
577 // TODO(sra): target could be Label+offset. It is not clear how to guess 578 // TODO(sra): target could be Label+offset. It is not clear how to guess
578 // which it might be. We assume offset==0. 579 // which it might be. We assume offset==0.
579 if (!program->EmitAbs32(program->FindOrMakeAbs32Label(target_rva))) 580 if (!program->EmitAbs32(program->FindOrMakeAbs32Label(target_rva)))
580 return false; 581 return false;
581 p += 4; 582 p += 4;
582 continue; 583 continue;
583 } 584 }
584 585
585 while (rel32_pos != rel32_locations_.end() && *rel32_pos < current_rva) 586 while (rel32_pos != rel32_locations_.end() && *rel32_pos < current_rva)
586 ++rel32_pos; 587 ++rel32_pos;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 directory->size_ = static_cast<uint32>(size); 724 directory->size_ = static_cast<uint32>(size);
724 return true; 725 return true;
725 } else { 726 } else {
726 directory->address_ = 0; 727 directory->address_ = 0;
727 directory->size_ = 0; 728 directory->size_ = 0;
728 return true; 729 return true;
729 } 730 }
730 } 731 }
731 732
732 } // namespace courgette 733 } // namespace courgette
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698