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

Side by Side Diff: courgette/disassembler.cc

Issue 8417045: Last small bit of refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « courgette/disassembler.h ('k') | courgette/disassembler_win32_x86.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "courgette/disassembler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 Disassembler* disassembler = DetectDisassembler(buffer, length); 43 Disassembler* disassembler = DetectDisassembler(buffer, length);
44 44
45 if (disassembler) { 45 if (disassembler) {
46 *type = disassembler->kind(); 46 *type = disassembler->kind();
47 *detected_length = disassembler->length(); 47 *detected_length = disassembler->length();
48 delete disassembler; 48 delete disassembler;
49 return C_OK; 49 return C_OK;
50 } 50 }
51 51
52 // We failed to detect anything 52 // We failed to detect anything
53 *type = UNKNOWN; 53 *type = EXE_UNKNOWN;
54 *detected_length = 0; 54 *detected_length = 0;
55 return C_INPUT_NOT_RECOGNIZED; 55 return C_INPUT_NOT_RECOGNIZED;
56 } 56 }
57 57
58 Status ParseDetectedExecutable(const void* buffer, size_t length, 58 Status ParseDetectedExecutable(const void* buffer, size_t length,
59 AssemblyProgram** output) { 59 AssemblyProgram** output) {
60 *output = NULL; 60 *output = NULL;
61 61
62 Disassembler* disassembler = DetectDisassembler(buffer, length); 62 Disassembler* disassembler = DetectDisassembler(buffer, length);
63 63
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 failure_reason_ = reason; 106 failure_reason_ = reason;
107 return false; 107 return false;
108 } 108 }
109 109
110 void Disassembler::ReduceLength(size_t reduced_length) { 110 void Disassembler::ReduceLength(size_t reduced_length) {
111 if (reduced_length < length_) 111 if (reduced_length < length_)
112 length_ = reduced_length; 112 length_ = reduced_length;
113 } 113 }
114 114
115 } // namespace courgette 115 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/disassembler.h ('k') | courgette/disassembler_win32_x86.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698