diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-28 18:49:58 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-28 18:49:58 +0000 |
commit | 3a1275d5f449608b95f131d693c2e9b2f9d10a2a (patch) | |
tree | ad166bd5a1987958a250bce3f3fbbfa9f14d415d | |
parent | aa3250ce8045286f822ca88f05eb072e823e985d (diff) | |
download | chromium_src-3a1275d5f449608b95f131d693c2e9b2f9d10a2a.zip chromium_src-3a1275d5f449608b95f131d693c2e9b2f9d10a2a.tar.gz chromium_src-3a1275d5f449608b95f131d693c2e9b2f9d10a2a.tar.bz2 |
Coverity: Pass parameters by reference.
CID=12947,13008,13087,13144,13280,13479,13480,13574,13575,13576,13580,13594,
13595,14186,14351
BUG=none
TEST=none
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/6733043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79595 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 45 insertions, 37 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_win.cc b/chrome/browser/accessibility/browser_accessibility_win.cc index 5f38a03..80e4e48 100644 --- a/chrome/browser/accessibility/browser_accessibility_win.cc +++ b/chrome/browser/accessibility/browser_accessibility_win.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. @@ -1193,7 +1193,7 @@ HRESULT BrowserAccessibilityWin::GetAttributeAsBstr( return S_OK; } -string16 BrowserAccessibilityWin::Escape(string16 str) { +string16 BrowserAccessibilityWin::Escape(const string16& str) { return EscapeQueryParamValueUTF8(str, false); } diff --git a/chrome/browser/accessibility/browser_accessibility_win.h b/chrome/browser/accessibility/browser_accessibility_win.h index fab1f2a..879a7dc 100644 --- a/chrome/browser/accessibility/browser_accessibility_win.h +++ b/chrome/browser/accessibility/browser_accessibility_win.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. @@ -464,7 +464,7 @@ class BrowserAccessibilityWin WebAccessibility::Attribute attribute, BSTR* value_bstr); // Escape a string like it would be escaped for a URL or HTML form. - string16 Escape(string16 str); + string16 Escape(const string16& str); // Get the text of this node for the purposes of IAccessibleText - it may // be the name, it may be the value, etc. depending on the role. diff --git a/chrome/browser/accessibility_events.h b/chrome/browser/accessibility_events.h index 47d50fb..73a074d 100644 --- a/chrome/browser/accessibility_events.h +++ b/chrome/browser/accessibility_events.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. @@ -193,7 +193,8 @@ class AccessibilityTextBoxInfo : public AccessibilityControlInfo { virtual void SerializeToDict(DictionaryValue* dict) const; - void SetValue(std::string value, int selection_start, int selection_end) { + void SetValue( + const std::string& value, int selection_start, int selection_end) { value_ = value; selection_start_ = selection_start; selection_end_ = selection_end; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index b4edba0..47e7f3a 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -2007,7 +2007,7 @@ void TestingAutomationProvider::CaptureEntirePageAsPNG( } void TestingAutomationProvider::SendJSONRequest(int handle, - std::string json_request, + const std::string& json_request, IPC::Message* reply_message) { scoped_ptr<Value> values; base::JSONReader reader; diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 7142094..c44429e 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -366,7 +366,7 @@ class TestingAutomationProvider : public AutomationProvider, // Generic pattern for pyautolib // Uses the JSON interface for input/output. void SendJSONRequest(int handle, - std::string json_request, + const std::string& json_request, IPC::Message* reply_message); // Method ptr for json handlers. diff --git a/chrome/browser/browser_signin.cc b/chrome/browser/browser_signin.cc index 0924f05..f30c227 100644 --- a/chrome/browser/browser_signin.cc +++ b/chrome/browser/browser_signin.cc @@ -77,8 +77,8 @@ class BrowserSigninHtml : public HtmlDialogUIDelegate, public WebUIMessageHandler { public: BrowserSigninHtml(BrowserSignin* signin, - string16 suggested_email, - string16 login_message); + const string16& suggested_email, + const string16& login_message); virtual ~BrowserSigninHtml() {} // HtmlDialogUIDelegate implementation @@ -135,8 +135,8 @@ class BrowserSigninHtml : public HtmlDialogUIDelegate, }; BrowserSigninHtml::BrowserSigninHtml(BrowserSignin* signin, - string16 suggested_email, - string16 login_message) + const string16& suggested_email, + const string16& login_message) : signin_(signin), suggested_email_(suggested_email), login_message_(login_message), diff --git a/chrome/browser/extensions/extension_menu_manager.cc b/chrome/browser/extensions/extension_menu_manager.cc index f364787..c87dfb7 100644 --- a/chrome/browser/extensions/extension_menu_manager.cc +++ b/chrome/browser/extensions/extension_menu_manager.cc @@ -22,7 +22,7 @@ #include "webkit/glue/context_menu.h" ExtensionMenuItem::ExtensionMenuItem(const Id& id, - std::string title, + const std::string& title, bool checked, Type type, const ContextList& contexts) @@ -477,7 +477,9 @@ ExtensionMenuItem::Id::Id() : profile(NULL), uid(0) { } -ExtensionMenuItem::Id::Id(Profile* profile, std::string extension_id, int uid) +ExtensionMenuItem::Id::Id(Profile* profile, + const std::string& extension_id, + int uid) : profile(profile), extension_id(extension_id), uid(uid) { } diff --git a/chrome/browser/extensions/extension_menu_manager.h b/chrome/browser/extensions/extension_menu_manager.h index 2718c7c..b54d57a 100644 --- a/chrome/browser/extensions/extension_menu_manager.h +++ b/chrome/browser/extensions/extension_menu_manager.h @@ -36,7 +36,7 @@ class ExtensionMenuItem { // An Id uniquely identifies a context menu item registered by an extension. struct Id { Id(); - Id(Profile* profile, std::string extension_id, int uid); + Id(Profile* profile, const std::string& extension_id, int uid); ~Id(); bool operator==(const Id& other) const; @@ -99,7 +99,10 @@ class ExtensionMenuItem { uint32 value_; // A bitmask of Context values. }; - ExtensionMenuItem(const Id& id, std::string title, bool checked, Type type, + ExtensionMenuItem(const Id& id, + const std::string& title, + bool checked, + Type type, const ContextList& contexts); virtual ~ExtensionMenuItem(); diff --git a/chrome/browser/extensions/extension_processes_api.cc b/chrome/browser/extensions/extension_processes_api.cc index 3944b47..266afdc 100644 --- a/chrome/browser/extensions/extension_processes_api.cc +++ b/chrome/browser/extensions/extension_processes_api.cc @@ -27,7 +27,7 @@ namespace keys = extension_processes_api_constants; DictionaryValue* CreateProcessValue(int process_id, - std::string type, + const std::string& type, double cpu, int64 net, int64 pr_mem, diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index 5b062d3..fae2ce7 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -70,7 +70,7 @@ static bool GetTabById(int tab_id, Profile* profile, // (chrome-extension://<id>/). Using the source frame url would be more correct, // but because the api shipped with urls resolved relative to their extension // base, we decided it wasn't worth breaking existing extensions to fix. -static GURL ResolvePossiblyRelativeURL(std::string url_string, +static GURL ResolvePossiblyRelativeURL(const std::string& url_string, const Extension* extension); // Return the type name for a browser window type. @@ -1228,6 +1228,7 @@ void DetectTabLanguageFunction::GotLanguage(const std::string& language) { } // static helpers +// TODO(jhawkins): Move these to unnamed namespace and remove static modifier. static Browser* GetBrowserInProfileWithId(Profile* profile, const int window_id, @@ -1280,7 +1281,7 @@ static std::string GetWindowTypeText(Browser::Type type) { return keys::kWindowTypeValueNormal; } -static GURL ResolvePossiblyRelativeURL(std::string url_string, +static GURL ResolvePossiblyRelativeURL(const std::string& url_string, const Extension* extension) { GURL url = GURL(url_string); if (!url.is_valid()) diff --git a/chrome/browser/extensions/extension_tts_api.cc b/chrome/browser/extensions/extension_tts_api.cc index c618db3..997f080 100644 --- a/chrome/browser/extensions/extension_tts_api.cc +++ b/chrome/browser/extensions/extension_tts_api.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. @@ -257,7 +257,7 @@ void ExtensionTtsController::Stop() { } void ExtensionTtsController::OnSpeechFinished( - int request_id, std::string error_message) { + int request_id, const std::string& error_message) { // We may sometimes receive completion callbacks "late", after we've // already finished the utterance (for example because another utterance // interrupted or we got a call to Stop). It's also possible that a buggy diff --git a/chrome/browser/extensions/extension_tts_api.h b/chrome/browser/extensions/extension_tts_api.h index 226d8e5..ad436a8 100644 --- a/chrome/browser/extensions/extension_tts_api.h +++ b/chrome/browser/extensions/extension_tts_api.h @@ -24,7 +24,7 @@ class ExtensionTtsPlatformImpl { // will be empty strings, and rate, pitch, and volume will be -1.0. // // The ExtensionTtsController will only try to speak one utterance at - // a time. If it wants to intterupt speech, it will always call Stop + // a time. If it wants to interrupt speech, it will always call Stop // before speaking again, otherwise it will wait until IsSpeaking // returns false before calling Speak again. virtual bool Speak( @@ -148,7 +148,7 @@ class ExtensionTtsController { void Stop(); // Called when an extension finishes speaking an utterance. - void OnSpeechFinished(int request_id, std::string error_message); + void OnSpeechFinished(int request_id, const std::string& error_message); // For unit testing. void SetPlatformImpl(ExtensionTtsPlatformImpl* platform_impl); diff --git a/chrome/browser/search_engines/search_provider_install_data.cc b/chrome/browser/search_engines/search_provider_install_data.cc index 0202e6e..f87177a 100644 --- a/chrome/browser/search_engines/search_provider_install_data.cc +++ b/chrome/browser/search_engines/search_provider_install_data.cc @@ -30,7 +30,7 @@ namespace { // Implementation of SearchTermsData that may be used on the I/O thread. class IOThreadSearchTermsData : public SearchTermsData { public: - explicit IOThreadSearchTermsData(std::string google_base_url); + explicit IOThreadSearchTermsData(const std::string& google_base_url); // Implementation of SearchTermsData. virtual std::string GoogleBaseURLValue() const; @@ -48,8 +48,8 @@ class IOThreadSearchTermsData : public SearchTermsData { DISALLOW_COPY_AND_ASSIGN(IOThreadSearchTermsData); }; -IOThreadSearchTermsData::IOThreadSearchTermsData(std::string google_base_url) - : google_base_url_(google_base_url) { +IOThreadSearchTermsData::IOThreadSearchTermsData( + const std::string& google_base_url) : google_base_url_(google_base_url) { } std::string IOThreadSearchTermsData::GoogleBaseURLValue() const { diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc index fe3454f..989f6a9 100644 --- a/chrome/browser/sync/profile_sync_service_harness.cc +++ b/chrome/browser/sync/profile_sync_service_harness.cc @@ -580,7 +580,7 @@ std::string ProfileSyncServiceHarness::GetUpdatedTimestamp( return snap->download_progress_markers[model_type]; } -void ProfileSyncServiceHarness::LogClientInfo(std::string message) { +void ProfileSyncServiceHarness::LogClientInfo(const std::string& message) { if (service()) { const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); if (snap) { diff --git a/chrome/browser/sync/profile_sync_service_harness.h b/chrome/browser/sync/profile_sync_service_harness.h index d895e6a..5b62795 100644 --- a/chrome/browser/sync/profile_sync_service_harness.h +++ b/chrome/browser/sync/profile_sync_service_harness.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. @@ -187,7 +187,7 @@ class ProfileSyncServiceHarness : public ProfileSyncServiceObserver { bool MatchesOtherClient(ProfileSyncServiceHarness* partner); // Logs message with relevant info about client's sync state (if available). - void LogClientInfo(std::string message); + void LogClientInfo(const std::string& message); // Gets the current progress indicator of the current sync session // for a particular datatype. diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index 29475c4..a1ab209 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -235,13 +235,13 @@ class InstalledBubbleContent : public views::View, void ExtensionInstalledBubble::Show(const Extension* extension, Browser *browser, - SkBitmap icon) { + const SkBitmap& icon) { new ExtensionInstalledBubble(extension, browser, icon); } ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension, Browser *browser, - SkBitmap icon) + const SkBitmap& icon) : extension_(extension), browser_(browser), icon_(icon), diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.h b/chrome/browser/ui/views/extensions/extension_installed_bubble.h index 3a9c12a0..c6deda6 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.h +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.h @@ -45,14 +45,15 @@ class ExtensionInstalledBubble // the extension has loaded. |extension| is the installed extension. |browser| // is the browser window which will host the bubble. |icon| is the install // icon of the extension. - static void Show(const Extension* extension, Browser *browser, SkBitmap icon); + static void Show( + const Extension* extension, Browser *browser, const SkBitmap& icon); private: friend class base::RefCountedThreadSafe<ExtensionInstalledBubble>; // Private ctor. Registers a listener for EXTENSION_LOADED. - ExtensionInstalledBubble(const Extension* extension, Browser *browser, - SkBitmap icon); + ExtensionInstalledBubble( + const Extension* extension, Browser *browser, const SkBitmap& icon); virtual ~ExtensionInstalledBubble(); diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index c34ed8d..c2ee5eb 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -503,7 +503,7 @@ void GoogleChromeDistribution::UpdateInstallStatus(bool system_install, // command line, but HKCU otherwise. |experiment_group| is the value to write // and |last_write| is used when writing to HKLM to determine whether to close // the handle when done. -void SetClient(std::wstring experiment_group, bool last_write) { +void SetClient(const std::wstring& experiment_group, bool last_write) { static int reg_key_handle = -1; if (reg_key_handle == -1) { // If a specific Toast Results key handle (presumably to our HKLM key) was diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index 88bb5e4..91efe42 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -378,7 +378,7 @@ class DispatcherWrapper virtual ~DispatcherWrapper() {} bool Init(base::ProcessHandle plugin_process_handle, - IPC::ChannelHandle channel_handle, + const IPC::ChannelHandle& channel_handle, PP_Module pp_module, pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface); @@ -399,7 +399,7 @@ class DispatcherWrapper bool DispatcherWrapper::Init( base::ProcessHandle plugin_process_handle, - IPC::ChannelHandle channel_handle, + const IPC::ChannelHandle& channel_handle, PP_Module pp_module, pp::proxy::Dispatcher::GetInterfaceFunc local_get_interface) { dispatcher_.reset(new pp::proxy::HostDispatcher( |