From 0cf986fdacf68aa07f1edbd907d5d1b336950c22 Mon Sep 17 00:00:00 2001 From: "finnur@chromium.org" Date: Mon, 28 Mar 2011 10:45:01 +0000 Subject: Initialize a few uninitialized member variables and structs in PPAPI. BUG=None TEST=None CID=14043, 14386, 14232, 14230, 14112, 14111, 14110, 14109, 14108, 14231, 14042, 14187, 14664. Review URL: http://codereview.chromium.org/6676145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79540 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/cpp/paint_aggregator.cc | 4 ++-- ppapi/cpp/var.cc | 10 +++++++++- ppapi/cpp/var.h | 8 +++++--- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'ppapi/cpp') diff --git a/ppapi/cpp/paint_aggregator.cc b/ppapi/cpp/paint_aggregator.cc index 1138974..d0ab03e 100644 --- a/ppapi/cpp/paint_aggregator.cc +++ b/ppapi/cpp/paint_aggregator.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,7 +25,7 @@ namespace pp { -PaintAggregator::PaintUpdate::PaintUpdate() {} +PaintAggregator::PaintUpdate::PaintUpdate() : has_scroll(false) {} PaintAggregator::PaintUpdate::~PaintUpdate() {} diff --git a/ppapi/cpp/var.cc b/ppapi/cpp/var.cc index 43bc869..09a91d8 100644 --- a/ppapi/cpp/var.cc +++ b/ppapi/cpp/var.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,28 +44,33 @@ using namespace deprecated; Var::Var() { var_.type = PP_VARTYPE_UNDEFINED; + var_.padding = 0; needs_release_ = false; } Var::Var(Null) { var_.type = PP_VARTYPE_NULL; + var_.padding = 0; needs_release_ = false; } Var::Var(bool b) { var_.type = PP_VARTYPE_BOOL; + var_.padding = 0; var_.value.as_bool = BoolToPPBool(b); needs_release_ = false; } Var::Var(int32_t i) { var_.type = PP_VARTYPE_INT32; + var_.padding = 0; var_.value.as_int = i; needs_release_ = false; } Var::Var(double d) { var_.type = PP_VARTYPE_DOUBLE; + var_.padding = 0; var_.value.as_double = d; needs_release_ = false; } @@ -77,6 +82,7 @@ Var::Var(const char* utf8_str) { Module::Get()->pp_module(), utf8_str, len); } else { var_.type = PP_VARTYPE_NULL; + var_.padding = 0; } needs_release_ = (var_.type == PP_VARTYPE_STRING); } @@ -89,6 +95,7 @@ Var::Var(const std::string& utf8_str) { static_cast(utf8_str.size())); } else { var_.type = PP_VARTYPE_NULL; + var_.padding = 0; } needs_release_ = (var_.type == PP_VARTYPE_STRING); } @@ -100,6 +107,7 @@ Var::Var(Instance* instance, ScriptableObject* object) { needs_release_ = true; } else { var_.type = PP_VARTYPE_NULL; + var_.padding = 0; needs_release_ = false; } } diff --git a/ppapi/cpp/var.h b/ppapi/cpp/var.h index e055cad..0154fd3 100644 --- a/ppapi/cpp/var.h +++ b/ppapi/cpp/var.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -171,10 +171,12 @@ class Var { OutException(Var* v) : output_(v), originally_had_exception_(v && v->is_null()) { - if (output_) + if (output_) { temp_ = output_->var_; - else + } else { + temp_.padding = 0; temp_.type = PP_VARTYPE_UNDEFINED; + } } ~OutException() { if (output_ && !originally_had_exception_) -- cgit v1.1