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

Side by Side Diff: courgette/image_info.cc

Issue 155820: Coverity fixes to keep coverity quiet.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « courgette/encoded_program.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/image_info.h" 5 #include "courgette/image_info.h"
6 6
7 #include <memory.h> 7 #include <memory.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <sstream> 11 #include <sstream>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 15
16 namespace courgette { 16 namespace courgette {
17 17
18 std::string SectionName(const Section* section) { 18 std::string SectionName(const Section* section) {
19 if (section == NULL) 19 if (section == NULL)
20 return "<none>"; 20 return "<none>";
21 char name[9]; 21 char name[9];
22 memcpy(name, section->name, 8); 22 memcpy(name, section->name, 8);
23 name[8] = '\0'; // Ensure termination. 23 name[8] = '\0'; // Ensure termination.
24 return name; 24 return name;
25 } 25 }
26 26
27 PEInfo::PEInfo() 27 PEInfo::PEInfo()
28 : failure_reason_("uninitialized"), 28 : failure_reason_("uninitialized"),
29 start_(0), end_(0), length_(0), 29 start_(0),
30 is_PE32_plus_(0), file_length_(0), has_text_section_(false) { 30 end_(0),
31 length_(0),
32 is_PE32_plus_(false),
33 file_length_(0),
34 optional_header_(NULL),
35 size_of_optional_header_(0),
36 offset_of_data_directories_(0),
37 machine_type_(0),
38 number_of_sections_(0),
39 sections_(NULL),
40 has_text_section_(false),
41 size_of_code_(0),
42 size_of_initialized_data_(0),
43 size_of_uninitialized_data_(0),
44 base_of_code_(0),
45 base_of_data_(0),
46 image_base_(0),
47 size_of_image_(0),
48 number_of_data_directories_(0) {
31 } 49 }
32 50
33 void PEInfo::Init(const void* start, size_t length) { 51 void PEInfo::Init(const void* start, size_t length) {
34 start_ = reinterpret_cast<const uint8*>(start); 52 start_ = reinterpret_cast<const uint8*>(start);
35 length_ = length; 53 length_ = length;
36 end_ = start_ + length_; 54 end_ = start_ + length_;
37 failure_reason_ = "unparsed"; 55 failure_reason_ = "unparsed";
38 } 56 }
39 57
40 // DescribeRVA is for debugging only. I would put it under #ifdef DEBUG except 58 // DescribeRVA is for debugging only. I would put it under #ifdef DEBUG except
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 402
385 block += size; 403 block += size;
386 } 404 }
387 405
388 std::sort(relocs->begin(), relocs->end()); 406 std::sort(relocs->begin(), relocs->end());
389 407
390 return true; 408 return true;
391 } 409 }
392 410
393 } // namespace courgette 411 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/encoded_program.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698