From 4541c7e3b14ba45bc81d7dcf7ff6a05f587233b5 Mon Sep 17 00:00:00 2001 From: "groby@chromium.org" Date: Wed, 22 Jun 2011 19:25:08 +0000 Subject: Coverity fixes for CHECKED_RETURN CID=16094,12870,12867,12738,12649 R=vandebo@chromium.org BUG=none TEST=none Review URL: http://codereview.chromium.org/7218028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90068 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/automation/testing_automation_provider.cc | 8 ++++---- chrome/browser/ui/webui/history2_ui.cc | 4 ++-- chrome/browser/ui/webui/options/core_options_handler.cc | 6 ++---- chrome/browser/webdata/keyword_table.cc | 3 ++- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 7096da1..abde491 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -3440,9 +3440,9 @@ void TestingAutomationProvider::ImportSettings(Browser* browser, int num_items = import_items_list->GetSize(); for (int i = 0; i < num_items; i++) { std::string item; - import_items_list->GetString(i, &item); // If the provided string is not part of the map, error out. - if (!ContainsKey(string_to_import_item, item)) { + if (!import_items_list->GetString(i, &item) || + !ContainsKey(string_to_import_item, item)) { AutomationJSONReply(this, reply_message) .SendError("Invalid item string found in import_items."); return; @@ -3663,9 +3663,9 @@ void TestingAutomationProvider::ClearBrowsingData( int num_removals = to_remove->GetSize(); for (int i = 0; i < num_removals; i++) { std::string removal; - to_remove->GetString(i, &removal); // If the provided string is not part of the map, then error out. - if (!ContainsKey(string_to_mask_value, removal)) { + if (!to_remove->GetString(i, &removal) || + !ContainsKey(string_to_mask_value, removal)) { AutomationJSONReply(this, reply_message) .SendError("Invalid browsing data string found in to_remove."); return; diff --git a/chrome/browser/ui/webui/history2_ui.cc b/chrome/browser/ui/webui/history2_ui.cc index c9cab20..63ff80c 100644 --- a/chrome/browser/ui/webui/history2_ui.cc +++ b/chrome/browser/ui/webui/history2_ui.cc @@ -325,8 +325,8 @@ void BrowsingHistoryHandler2::ExtractSearchHistoryArguments( const StringValue* string_value = static_cast(list_member); string16 string16_value; - string_value->GetAsString(&string16_value); - base::StringToInt(string16_value, month); + if (string_value->GetAsString(&string16_value)) + base::StringToInt(string16_value, month); } } diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc index d16ee4c..05dbb4b 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.cc +++ b/chrome/browser/ui/webui/options/core_options_handler.cc @@ -324,10 +324,8 @@ void CoreOptionsHandler::HandleSetPref(const ListValue* args, CHECK_EQ(type, value->GetType()); std::string metric; - if (args->GetSize() > 2) - args->GetString(2, &metric); - - SetPref(pref_name, value, metric); + if (args->GetSize() > 2 && args->GetString(2, &metric)) + SetPref(pref_name, value, metric); } void CoreOptionsHandler::HandleClearPref(const ListValue* args) { diff --git a/chrome/browser/webdata/keyword_table.cc b/chrome/browser/webdata/keyword_table.cc index fd812e5..2e31a8a 100644 --- a/chrome/browser/webdata/keyword_table.cc +++ b/chrome/browser/webdata/keyword_table.cc @@ -223,7 +223,8 @@ bool KeywordTable::SetBuitinKeywordVersion(int version) { int KeywordTable::GetBuitinKeywordVersion() { int version = 0; - meta_table_->GetValue(kBuiltinKeywordVersion, &version); + if (!meta_table_->GetValue(kBuiltinKeywordVersion, &version)) + return 0; return version; } -- cgit v1.1