summaryrefslogtreecommitdiffstats
path: root/courgette
diff options
context:
space:
mode:
authorsra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 01:30:06 +0000
committersra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 01:30:06 +0000
commitd38c3a28213b3a2bc62df703c231eebf0bb5dbf4 (patch)
treef621cc23ae43d38cce013c5a795e35a043c4bc34 /courgette
parent31856be711996fc573ca6203db7512ab6089899d (diff)
downloadchromium_src-d38c3a28213b3a2bc62df703c231eebf0bb5dbf4.zip
chromium_src-d38c3a28213b3a2bc62df703c231eebf0bb5dbf4.tar.gz
chromium_src-d38c3a28213b3a2bc62df703c231eebf0bb5dbf4.tar.bz2
Coverity fixes to keep coverity quiet.
Only the first issue is remotely interesting. * Possibility (low) of using NULL SinkStream* courgette tool 'gen1a' command. * Added initializers for all class members to several constructors. * return 0 at end of from wmain. BUG=none TEST=existing Review URL: http://codereview.chromium.org/155820 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21253 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette')
-rw-r--r--courgette/adjustment_method.cc9
-rw-r--r--courgette/adjustment_method_2.cc2
-rw-r--r--courgette/courgette_minimal_tool.cc2
-rw-r--r--courgette/courgette_tool.cc7
-rw-r--r--courgette/encoded_program.cc2
-rw-r--r--courgette/image_info.cc22
6 files changed, 35 insertions, 9 deletions
diff --git a/courgette/adjustment_method.cc b/courgette/adjustment_method.cc
index 5a2f109..930dc59 100644
--- a/courgette/adjustment_method.cc
+++ b/courgette/adjustment_method.cc
@@ -219,7 +219,9 @@ class AssignmentProblem {
AssignmentProblem(const Trace& model,
const Trace& problem)
: m_trace_(model),
- p_trace_(problem) {
+ p_trace_(problem),
+ m_root_(NULL),
+ p_root_(NULL) {
}
~AssignmentProblem() {
@@ -579,7 +581,10 @@ class AssignmentProblem {
class GraphAdjuster : public AdjustmentMethod {
public:
- GraphAdjuster() {}
+ GraphAdjuster()
+ : prog_(NULL),
+ model_(NULL),
+ debug_label_index_gen_(0) {}
~GraphAdjuster() {}
bool Adjust(const AssemblyProgram& model, AssemblyProgram* program) {
diff --git a/courgette/adjustment_method_2.cc b/courgette/adjustment_method_2.cc
index f995748..49fcf49 100644
--- a/courgette/adjustment_method_2.cc
+++ b/courgette/adjustment_method_2.cc
@@ -1248,7 +1248,7 @@ class AssignmentProblem {
class Adjuster : public AdjustmentMethod {
public:
- Adjuster() {}
+ Adjuster() : prog_(NULL), model_(NULL) {}
~Adjuster() {}
bool Adjust(const AssemblyProgram& model, AssemblyProgram* program) {
diff --git a/courgette/courgette_minimal_tool.cc b/courgette/courgette_minimal_tool.cc
index 2f99ca9..2fd32c1 100644
--- a/courgette/courgette_minimal_tool.cc
+++ b/courgette/courgette_minimal_tool.cc
@@ -51,4 +51,6 @@ int main(int argc, const char* argv[]) {
if (status == courgette::C_WRITE_ERROR) Problem("Can't write to file.");
Problem("patch failed.");
}
+
+ return 0;
}
diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc
index 47b2dc6..91f02aa6 100644
--- a/courgette/courgette_tool.cc
+++ b/courgette/courgette_tool.cc
@@ -217,16 +217,17 @@ void DisassembleAdjustDiff(const std::wstring& model_file,
Problem("Can't serialize encoded model.");
courgette::DeleteEncodedProgram(encoded_model);
+ courgette::SinkStream empty_sink;
for (int i = 0; ; ++i) {
courgette::SinkStream* old_stream = model_sinks.stream(i);
courgette::SinkStream* new_stream = program_sinks.stream(i);
- if (old_stream == NULL && new_stream == NULL)
+ if (old_stream == NULL && new_stream == NULL)
break;
courgette::SourceStream old_source;
courgette::SourceStream new_source;
- old_source.Init(*old_stream);
- new_source.Init(*new_stream);
+ old_source.Init(old_stream ? *old_stream : empty_sink);
+ new_source.Init(new_stream ? *new_stream : empty_sink);
courgette::SinkStream patch_stream;
courgette::BSDiffStatus status =
courgette::CreateBinaryPatch(&old_source, &new_source, &patch_stream);
diff --git a/courgette/encoded_program.cc b/courgette/encoded_program.cc
index 98d70c9..1265312 100644
--- a/courgette/encoded_program.cc
+++ b/courgette/encoded_program.cc
@@ -33,7 +33,7 @@ const int kStreamLimit = 9;
// Constructor is here rather than in the header. Although the constructor
// appears to do nothing it is fact quite large because of the implict calls to
// field constructors. Ditto for the destructor.
-EncodedProgram::EncodedProgram() {}
+EncodedProgram::EncodedProgram() : image_base_(0) {}
EncodedProgram::~EncodedProgram() {}
// Serializes a vector of integral values using Varint32 coding.
diff --git a/courgette/image_info.cc b/courgette/image_info.cc
index ed42f12..8d1b9aa 100644
--- a/courgette/image_info.cc
+++ b/courgette/image_info.cc
@@ -26,8 +26,26 @@ std::string SectionName(const Section* section) {
PEInfo::PEInfo()
: failure_reason_("uninitialized"),
- start_(0), end_(0), length_(0),
- is_PE32_plus_(0), file_length_(0), has_text_section_(false) {
+ start_(0),
+ end_(0),
+ length_(0),
+ is_PE32_plus_(false),
+ file_length_(0),
+ optional_header_(NULL),
+ size_of_optional_header_(0),
+ offset_of_data_directories_(0),
+ machine_type_(0),
+ number_of_sections_(0),
+ sections_(NULL),
+ has_text_section_(false),
+ size_of_code_(0),
+ size_of_initialized_data_(0),
+ size_of_uninitialized_data_(0),
+ base_of_code_(0),
+ base_of_data_(0),
+ image_base_(0),
+ size_of_image_(0),
+ number_of_data_directories_(0) {
}
void PEInfo::Init(const void* start, size_t length) {