diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 01:58:24 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 01:58:24 +0000 |
commit | e555f205eb8931da7fdf0f4cb4a01a24c3e2bf8a (patch) | |
tree | 9b2c895be38b69c778d9081ffedaa928d2495aeb /chrome | |
parent | 05f2f45e9dff8e1a989f4308a97254e27a576c35 (diff) | |
download | chromium_src-e555f205eb8931da7fdf0f4cb4a01a24c3e2bf8a.zip chromium_src-e555f205eb8931da7fdf0f4cb4a01a24c3e2bf8a.tar.gz chromium_src-e555f205eb8931da7fdf0f4cb4a01a24c3e2bf8a.tar.bz2 |
Coverity: Pass parameters by reference.
Also remove an unused function that I found.
CID=2634,4471,5392,6433,6434,6535,6777,6780,6781,6792,6810,7665,7759,8056,8072,
8637,8718,8726
BUG=none
TEST=non
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/6730046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79651 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
21 files changed, 37 insertions, 82 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 648f1eb..188982f 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -90,7 +90,8 @@ AboutTcmallocOutputs::AboutTcmallocOutputs() {} AboutTcmallocOutputs::~AboutTcmallocOutputs() {} // Glue between the callback task and the method in the singleton. -void AboutTcmallocRendererCallback(base::ProcessId pid, std::string output) { +void AboutTcmallocRendererCallback(base::ProcessId pid, + const std::string& output) { AboutTcmallocOutputs::GetInstance()->RendererCallback(pid, output); } #endif diff --git a/chrome/browser/browser_about_handler.h b/chrome/browser/browser_about_handler.h index b894ceb..d319fbe 100644 --- a/chrome/browser/browser_about_handler.h +++ b/chrome/browser/browser_about_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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. @@ -52,14 +52,14 @@ class AboutTcmallocOutputs { AboutTcmallocOutputsType* outputs() { return &outputs_; } // Records the output for a specified header string. - void SetOutput(std::string header, std::string output) { + void SetOutput(const std::string& header, const std::string& output) { outputs_[header] = output; } // Callback for output returned from renderer processes. Adds // the output for a canonical renderer header string that // incorporates the pid. - void RendererCallback(base::ProcessId pid, std::string output) { + void RendererCallback(base::ProcessId pid, const std::string& output) { SetOutput(StringPrintf("Renderer PID %d", static_cast<int>(pid)), output); } @@ -75,7 +75,8 @@ class AboutTcmallocOutputs { }; // Glue between the callback task and the method in the singleton. -void AboutTcmallocRendererCallback(base::ProcessId pid, std::string output); +void AboutTcmallocRendererCallback(base::ProcessId pid, + const std::string& output); #endif #endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_ diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 60e4bae..86666f6 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -321,7 +321,7 @@ class DiskSpaceTest : public DiagnosticTest { // Checks that a given json file can be correctly parsed. class JSONTest : public DiagnosticTest { public: - JSONTest(const FilePath& path, const string16 name, int64 max_file_size) + JSONTest(const FilePath& path, const string16& name, int64 max_file_size) : DiagnosticTest(name), path_(path), max_file_size_(max_file_size) { } diff --git a/chrome/browser/dom_operation_notification_details.h b/chrome/browser/dom_operation_notification_details.h index 9b2266e..fc56394 100644 --- a/chrome/browser/dom_operation_notification_details.h +++ b/chrome/browser/dom_operation_notification_details.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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. // @@ -12,7 +12,7 @@ class DomOperationNotificationDetails { public: - DomOperationNotificationDetails(const std::string json, int automation_id) + DomOperationNotificationDetails(const std::string& json, int automation_id) : json_(json), automation_id_(automation_id) { } ~DomOperationNotificationDetails() { } diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 98e4fd6..868991d 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -154,7 +154,7 @@ bool ManifestFetchData::AddExtension(std::string id, std::string version, return true; } -bool ManifestFetchData::Includes(std::string extension_id) const { +bool ManifestFetchData::Includes(const std::string& extension_id) const { return extension_ids_.find(extension_id) != extension_ids_.end(); } diff --git a/chrome/browser/extensions/extension_updater.h b/chrome/browser/extensions/extension_updater.h index a2f67c6..07c90bf 100644 --- a/chrome/browser/extensions/extension_updater.h +++ b/chrome/browser/extensions/extension_updater.h @@ -75,7 +75,7 @@ class ManifestFetchData { const std::set<std::string>& extension_ids() const { return extension_ids_; } // Returns true if the given id is included in this manifest fetch. - bool Includes(std::string extension_id) const; + bool Includes(const std::string& extension_id) const; // Returns true if a ping parameter for |type| was added to full_url for this // extension id. diff --git a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc index 0d14069..5c79492 100644 --- a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc +++ b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.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. @@ -312,8 +312,8 @@ class ServerDeletedPathChecker { // returns 0 if we should stop investigating the path. static syncable::Id GetAndExamineParent(syncable::BaseTransaction* trans, - syncable::Id id, - syncable::Id check_id, + const syncable::Id& id, + const syncable::Id& check_id, const syncable::Entry& log_entry) { syncable::Entry parent(trans, syncable::GET_BY_ID, id); CHECK(parent.good()) << "Tree inconsitency, missing id" << id << " " @@ -334,8 +334,8 @@ class LocallyDeletedPathChecker { // returns 0 if we should stop investigating the path. static syncable::Id GetAndExamineParent(syncable::BaseTransaction* trans, - syncable::Id id, - syncable::Id check_id, + const syncable::Id& id, + const syncable::Id& check_id, const syncable::Entry& log_entry) { syncable::Entry parent(trans, syncable::GET_BY_ID, id); if (!parent.good()) diff --git a/chrome/browser/sync/engine/syncer_util.cc b/chrome/browser/sync/engine/syncer_util.cc index c1bed35..c20e206 100644 --- a/chrome/browser/sync/engine/syncer_util.cc +++ b/chrome/browser/sync/engine/syncer_util.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. @@ -639,28 +639,6 @@ void SyncerUtil::AddPredecessorsThenItem( std::reverse(commit_ids->begin() + initial_size, commit_ids->end()); } -// TODO(ncarter): This is redundant to some code in GetCommitIdsCommand. Unify -// them. -// static -void SyncerUtil::AddUncommittedParentsAndTheirPredecessors( - syncable::BaseTransaction* trans, - syncable::MetahandleSet* inserted_items, - std::vector<syncable::Id>* commit_ids, - syncable::Id parent_id) { - size_t intial_commit_ids_size = commit_ids->size(); - // Climb the tree adding entries leaf -> root. - while (!parent_id.ServerKnows()) { - Entry parent(trans, GET_BY_ID, parent_id); - CHECK(parent.good()) << "Bad user-only parent in item path."; - if (!AddItemThenPredecessors(trans, &parent, IS_UNSYNCED, inserted_items, - commit_ids)) - break; // Parent was already present in |inserted_items|. - parent_id = parent.Get(PARENT_ID); - } - // Reverse what we added to get the correct order. - std::reverse(commit_ids->begin() + intial_commit_ids_size, commit_ids->end()); -} - // static void SyncerUtil::MarkDeletedChildrenSynced( const syncable::ScopedDirLookup &dir, diff --git a/chrome/browser/sync/engine/syncer_util.h b/chrome/browser/sync/engine/syncer_util.h index b1d5e50..90de980 100644 --- a/chrome/browser/sync/engine/syncer_util.h +++ b/chrome/browser/sync/engine/syncer_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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. // @@ -127,12 +127,6 @@ class SyncerUtil { syncable::MetahandleSet* inserted_items, std::vector<syncable::Id>* commit_ids); - static void AddUncommittedParentsAndTheirPredecessors( - syncable::BaseTransaction* trans, - syncable::MetahandleSet* inserted_items, - std::vector<syncable::Id>* commit_ids, - syncable::Id parent_id); - static void MarkDeletedChildrenSynced( const syncable::ScopedDirLookup &dir, std::set<syncable::Id>* deleted_folders); diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index e9abb9e..395e6cc 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -886,7 +886,7 @@ string Directory::store_birthday() const { return kernel_->persisted_info.store_birthday; } -void Directory::set_store_birthday(string store_birthday) { +void Directory::set_store_birthday(const string& store_birthday) { ScopedKernelLock lock(this); if (kernel_->persisted_info.store_birthday == store_birthday) return; diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h index f20e80f..55f76bb 100644 --- a/chrome/browser/sync/syncable/syncable.h +++ b/chrome/browser/sync/syncable/syncable.h @@ -810,11 +810,11 @@ class Directory { const std::string& name() const { return kernel_->name; } - // (Account) Store birthday is opaque to the client, - // so we keep it in the format it is in the proto buffer - // in case we switch to a binary birthday later. + // (Account) Store birthday is opaque to the client, so we keep it in the + // format it is in the proto buffer in case we switch to a binary birthday + // later. std::string store_birthday() const; - void set_store_birthday(std::string store_birthday); + void set_store_birthday(const std::string& store_birthday); std::string GetAndClearNotificationState(); void SetNotificationState(const std::string& notification_state); diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 93633a9..274cae3 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -812,7 +812,7 @@ void BrowserThemePack::BuildDisplayPropertiesFromJSON( void BrowserThemePack::ParseImageNamesFromJSON( DictionaryValue* images_value, - FilePath images_path, + const FilePath& images_path, FilePathMap* file_paths) const { if (!images_value) return; diff --git a/chrome/browser/themes/browser_theme_pack.h b/chrome/browser/themes/browser_theme_pack.h index 9aba30d..ed3d26d 100644 --- a/chrome/browser/themes/browser_theme_pack.h +++ b/chrome/browser/themes/browser_theme_pack.h @@ -127,7 +127,7 @@ class BrowserThemePack : public base::RefCountedThreadSafe< // Parses the image names out of an extension. void ParseImageNamesFromJSON(DictionaryValue* images_value, - FilePath images_path, + const FilePath& images_path, FilePathMap* file_paths) const; // Creates the data for |source_images_| from |file_paths|. diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index d6e0305..e65d9e1 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -1266,8 +1266,7 @@ bool Extension::ParsePEMKeyBytes(const std::string& input, return base::Base64Decode(working, output); } -bool Extension::ProducePEM(const std::string& input, - std::string* output) { +bool Extension::ProducePEM(const std::string& input, std::string* output) { CHECK(output); if (input.length() == 0) return false; @@ -1275,7 +1274,7 @@ bool Extension::ProducePEM(const std::string& input, return base::Base64Encode(input, output); } -bool Extension::FormatPEMForFileOutput(const std::string input, +bool Extension::FormatPEMForFileOutput(const std::string& input, std::string* output, bool is_public) { CHECK(output); diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 6b40f15..861cad6 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -311,8 +311,9 @@ class Extension : public base::RefCountedThreadSafe<Extension> { // Expects base64 encoded |input| and formats into |output| including // the appropriate header & footer. - static bool FormatPEMForFileOutput(const std::string input, - std::string* output, bool is_public); + static bool FormatPEMForFileOutput(const std::string& input, + std::string* output, + bool is_public); // Determine whether |new_extension| has increased privileges compared to // its previously granted permissions, specified by |granted_apis|, diff --git a/chrome/common/extensions/extension_message_bundle.cc b/chrome/common/extensions/extension_message_bundle.cc index f0e60bc..26e9c97 100644 --- a/chrome/common/extensions/extension_message_bundle.cc +++ b/chrome/common/extensions/extension_message_bundle.cc @@ -336,7 +336,7 @@ ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap() { return &g_extension_to_messages_map.Get().messages_map; } -L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id) { +L10nMessagesMap* GetL10nMessagesMap(const std::string& extension_id) { ExtensionToL10nMessagesMap::iterator it = g_extension_to_messages_map.Get().messages_map.find(extension_id); if (it != g_extension_to_messages_map.Get().messages_map.end()) diff --git a/chrome/common/extensions/extension_message_bundle.h b/chrome/common/extensions/extension_message_bundle.h index 89e7fd4..8f3078e 100644 --- a/chrome/common/extensions/extension_message_bundle.h +++ b/chrome/common/extensions/extension_message_bundle.h @@ -159,6 +159,6 @@ typedef std::map<std::string, L10nMessagesMap > ExtensionToL10nMessagesMap; ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap(); // Returns message map that matches given extension_id, or NULL. -L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id); +L10nMessagesMap* GetL10nMessagesMap(const std::string& extension_id); #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_ diff --git a/chrome/common/spellcheck_common.cc b/chrome/common/spellcheck_common.cc index 21ff923..26d90ce 100644 --- a/chrome/common/spellcheck_common.cc +++ b/chrome/common/spellcheck_common.cc @@ -169,17 +169,4 @@ void SpellCheckLanguages(std::vector<std::string>* languages) { } } - -std::string GetLanguageFromLanguageRegion(std::string input_language) { - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(g_supported_spellchecker_languages); - ++i) { - std::string language( - g_supported_spellchecker_languages[i].language_region); - if (language == input_language) - return std::string(g_supported_spellchecker_languages[i].language); - } - - return input_language; -} - } // namespace SpellCheckCommon diff --git a/chrome/common/spellcheck_common.h b/chrome/common/spellcheck_common.h index 9074e16..cafffa8 100644 --- a/chrome/common/spellcheck_common.h +++ b/chrome/common/spellcheck_common.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -26,12 +26,6 @@ std::string GetCorrespondingSpellCheckLanguage(const std::string& language); // Get SpellChecker supported languages. void SpellCheckLanguages(std::vector<std::string>* languages); - -// This function returns ll (language code) from ll-RR where 'RR' (region -// code) is redundant. However, if the region code matters, it's preserved. -// That is, it returns 'hi' and 'en-GB' for 'hi-IN' and 'en-GB' respectively. -std::string GetLanguageFromLanguageRegion(std::string input_language); - } // namespace SpellCheckCommon #endif // CHROME_COMMON_SPELLCHECK_COMMON_H_ diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc index 9c700ae..0ed18ce 100644 --- a/chrome/renderer/spellchecker/spellcheck.cc +++ b/chrome/renderer/spellchecker/spellcheck.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -28,7 +28,7 @@ SpellCheck::~SpellCheck() { void SpellCheck::Init(base::PlatformFile file, const std::vector<std::string>& custom_words, - const std::string language) { + const std::string& language) { initialized_ = true; hunspell_.reset(); bdict_file_.reset(); diff --git a/chrome/renderer/spellchecker/spellcheck.h b/chrome/renderer/spellchecker/spellcheck.h index 6a5780d..29980b5 100644 --- a/chrome/renderer/spellchecker/spellcheck.h +++ b/chrome/renderer/spellchecker/spellcheck.h @@ -32,7 +32,7 @@ class SpellCheck { void Init(base::PlatformFile file, const std::vector<std::string>& custom_words, - const std::string language); + const std::string& language); // SpellCheck a word. // Returns true if spelled correctly, false otherwise. |