diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 00:03:18 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 00:03:18 +0000 |
commit | f6b8ce31c12a8fd5c969608bfdec0e2e8f1e99c3 (patch) | |
tree | 840cfc698d0c1287ef8802ca9a564ae7abdd0f13 /chrome | |
parent | 9ad77099038a76c96f6c4d162fb0706426215a5f (diff) | |
download | chromium_src-f6b8ce31c12a8fd5c969608bfdec0e2e8f1e99c3.zip chromium_src-f6b8ce31c12a8fd5c969608bfdec0e2e8f1e99c3.tar.gz chromium_src-f6b8ce31c12a8fd5c969608bfdec0e2e8f1e99c3.tar.bz2 |
Pure pedantry: Replace all ".size() == 0" with ".empty()".
BUG=carnitas
TEST=compiles; existing unit tests.
Review URL: http://codereview.chromium.org/6602049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
26 files changed, 31 insertions, 31 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm index 3149c15..48afd85 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm @@ -169,7 +169,7 @@ NSMutableAttributedString* AutocompletePopupViewMac::ElideString( } // If everything was elided away, clear the string. - if (elided.size() == 0) { + if (elided.empty()) { [aString deleteCharactersInRange:NSMakeRange(0, [aString length])]; return aString; } diff --git a/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm b/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm index 25b8fca..bfb6a7a 100644 --- a/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm +++ b/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm @@ -224,7 +224,7 @@ void WriteToClipboardPrivate( const std::vector<BookmarkNodeData::Element>& elements, NSPasteboard* pb, FilePath::StringType profile_path) { - if (elements.size() == 0) { + if (elements.empty()) { return; } NSArray* types = [NSArray arrayWithObjects:kBookmarkDictionaryListPboardType, diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index ddf6743..dc1693c 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -872,7 +872,7 @@ void AboutMemoryHandler::OnDetailsAvailable() { // Aggregate per-process data into browser summary data. std::wstring log_string; for (size_t index = 0; index < browser_processes.size(); index++) { - if (browser_processes[index].processes.size() == 0) + if (browser_processes[index].processes.empty()) continue; // Sum the information for the processes within this browser. diff --git a/chrome/browser/chromeos/network_message_observer.cc b/chrome/browser/chromeos/network_message_observer.cc index 951bffa..986a680 100644 --- a/chrome/browser/chromeos/network_message_observer.cc +++ b/chrome/browser/chromeos/network_message_observer.cc @@ -230,7 +230,7 @@ void NetworkMessageObserver::OnCellularDataPlanChanged(NetworkLibrary* cros) { cros->GetDataPlans(cellular->service_path()); // If no plans available, check to see if we need a new plan. - if (!plans || plans->size() == 0) { + if (!plans || plans->empty()) { // If previously, we had a low data notification, we know that a plan was // near expiring. In that case, because the plan has disappeared, we assume // that it expired. diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc index b930365..6cffd42 100644 --- a/chrome/browser/debugger/debugger_remote_service.cc +++ b/chrome/browser/debugger/debugger_remote_service.cc @@ -79,7 +79,7 @@ void DebuggerRemoteService::HandleMessage( content->GetString(kCommandKey, &command); response.SetString(kCommandKey, command); bool send_response = true; - if (destination.size() == 0) { + if (destination.empty()) { // Unknown command (bad format?) NOTREACHED(); response.SetInteger(kResultKey, RESULT_UNKNOWN_COMMAND); diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.cc b/chrome/browser/debugger/devtools_remote_listen_socket.cc index c5804d5..6e2a2ae 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket.cc +++ b/chrome/browser/debugger/devtools_remote_listen_socket.cc @@ -58,7 +58,7 @@ void DevToolsRemoteListenSocket::StartNextField() { state_ = HEADERS; break; case HEADERS: - if (protocol_field_.size() == 0) { // empty line - end of headers + if (protocol_field_.empty()) { // empty line - end of headers const std::string& payload_length_string = GetHeader( DevToolsRemoteMessageHeaders::kContentLength, "0"); base::StringToInt(payload_length_string, &remaining_payload_length_); diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc index f877473..0914594 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc +++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc @@ -176,7 +176,7 @@ bool DevToolsRemoteListenSocketTester::NextAction(int timeout) { if (ret != WAIT_OBJECT_0) return false; EnterCriticalSection(&lock_); - if (queue_.size() == 0) { + if (queue_.empty()) { LeaveCriticalSection(&lock_); return false; } @@ -197,7 +197,7 @@ bool DevToolsRemoteListenSocketTester::NextAction(int timeout) { break; } pthread_mutex_lock(&lock_); - if (queue_.size() == 0) { + if (queue_.empty()) { pthread_mutex_unlock(&lock_); return false; } diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index fd5c137..bb57b3c 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -478,7 +478,7 @@ bool CreateWindowFunction::RunImpl() { TabStripModel* target_tab_strip = new_window->tabstrip_model(); target_tab_strip->InsertTabContentsAt(urls.size(), contents, TabStripModel::ADD_NONE); - } else if (urls.size() == 0) { + } else if (urls.empty()) { new_window->NewTab(); } new_window->SelectNumberedTab(0); diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 317a2d5..eae62b4 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -35,7 +35,7 @@ static bool GetDeclarationValue(const base::StringPiece& line, std::string temp(line.data() + index + prefix.length(), line.length() - index - prefix.length()); - if (temp.size() == 0 || !IsWhitespace(temp[0])) + if (temp.empty() || !IsWhitespace(temp[0])) return false; TrimWhitespaceASCII(temp, TRIM_ALL, value); @@ -125,7 +125,7 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader( // If no patterns were specified, default to @include *. This is what // Greasemonkey does. - if (script->globs().size() == 0 && script->url_patterns().size() == 0) + if (script->globs().empty() && script->url_patterns().empty()) script->add_glob("*"); return true; diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 84afba6..dd7bb12 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -376,7 +376,7 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) { // If a redirect chain is given, we expect the last item in that chain to be // the final URL. - DCHECK(request->redirects.size() == 0 || + DCHECK(request->redirects.empty() || request->redirects.back() == request->url); // Avoid duplicating times in the database, at least as long as pages are diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc index 6bf3270..28c8da4d 100644 --- a/chrome/browser/history/text_database.cc +++ b/chrome/browser/history/text_database.cc @@ -367,7 +367,7 @@ void TextDatabase::GetTextMatches(const std::string& query, // When we have returned all the results possible (or determined that there // are none), then we have searched all the time requested, so we can // set the first_time_searched to that value. - if (results->size() == 0 || + if (results->empty() || options.max_count == 0 || // Special case for wanting all the results. static_cast<int>(results->size()) < options.max_count) { *first_time_searched = options.begin_time; diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc index abdb9c7..f53d1de 100644 --- a/chrome/browser/password_manager/password_store_mac.cc +++ b/chrome/browser/password_manager/password_store_mac.cc @@ -451,7 +451,7 @@ std::vector<PasswordForm*> GetPasswordsForForms( std::vector<PasswordForm*> keychain_matches = keychain_adapter.PasswordsMergeableWithForm(**i); MergePasswordForms(&keychain_matches, &db_form_container, &merged_forms); - if (db_form_container.size() == 0) { + if (db_form_container.empty()) { i = database_forms->erase(i); } else { ++i; @@ -626,7 +626,7 @@ SecKeychainItemRef MacKeychainPasswordFormAdapter::KeychainItemForForm( std::vector<SecKeychainItemRef> matches = MatchingKeychainItems( form.signon_realm, form.scheme, path.c_str(), username.c_str()); - if (matches.size() == 0) { + if (matches.empty()) { return NULL; } // Free all items after the first, since we won't be returning them. diff --git a/chrome/browser/process_info_snapshot_mac.cc b/chrome/browser/process_info_snapshot_mac.cc index 98216e0..10fc77b 100644 --- a/chrome/browser/process_info_snapshot_mac.cc +++ b/chrome/browser/process_info_snapshot_mac.cc @@ -249,7 +249,7 @@ static bool GetProcessMemoryInfoUsingTop( if (in.fail()) break; - if (unit.size() == 0) + if (unit.empty()) break; uint64_t scale; @@ -346,7 +346,7 @@ bool ProcessInfoSnapshot::Sample(std::vector<base::ProcessId> pid_list) { Reset(); // Nothing to do if no PIDs given. - if (pid_list.size() == 0) + if (pid_list.empty()) return true; if (pid_list.size() > kMaxPidListSize) { // The spec says |pid_list| *must* not have more than this many entries. diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index fab96a0..baba77e 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -210,7 +210,7 @@ class VisitedLinkUpdater { return; } - if (pending_.size() == 0) + if (pending_.empty()) return; sender->Send(new ViewMsg_VisitedLink_Add(pending_)); diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc index a9262ed..ae12609 100644 --- a/chrome/browser/renderer_host/web_cache_manager.cc +++ b/chrome/browser/renderer_host/web_cache_manager.cc @@ -256,7 +256,7 @@ void WebCacheManager::AddToStrategy(const std::set<int>& renderers, // Nothing to do if there are no renderers. It is common for there to be no // inactive renderers if there is a single active tab. - if (renderers.size() == 0) + if (renderers.empty()) return; // Divide the extra memory evenly among the renderers. diff --git a/chrome/browser/speech/speech_input_bubble_controller.cc b/chrome/browser/speech/speech_input_bubble_controller.cc index 58bda78..3d72744 100644 --- a/chrome/browser/speech/speech_input_bubble_controller.cc +++ b/chrome/browser/speech/speech_input_bubble_controller.cc @@ -21,7 +21,7 @@ SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate) } SpeechInputBubbleController::~SpeechInputBubbleController() { - DCHECK(bubbles_.size() == 0); + DCHECK(bubbles_.empty()); } void SpeechInputBubbleController::CreateBubble(int caller_id, diff --git a/chrome/browser/sync/glue/data_type_manager_impl.cc b/chrome/browser/sync/glue/data_type_manager_impl.cc index 46a6e4b..2d06f80 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl.cc @@ -125,7 +125,7 @@ void DataTypeManagerImpl::Configure(const TypeSet& desired_types) { SortComparator(&start_order_)); // If nothing changed, we're done. - if (needs_start_.size() == 0 && needs_stop_.size() == 0) { + if (needs_start_.empty() && needs_stop_.empty()) { state_ = CONFIGURED; NotifyStart(); NotifyDone(OK); diff --git a/chrome/browser/sync/glue/data_type_manager_impl2.cc b/chrome/browser/sync/glue/data_type_manager_impl2.cc index 9a80671..b4276d1 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl2.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl2.cc @@ -122,7 +122,7 @@ void DataTypeManagerImpl2::Configure(const TypeSet& desired_types) { SortComparator(&start_order_)); // If nothing changed, we're done. - if (needs_start_.size() == 0 && needs_stop_.size() == 0) { + if (needs_start_.empty() && needs_stop_.empty()) { state_ = CONFIGURED; NotifyStart(); NotifyDone(OK); diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index a25efa8..19cb00e 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -362,7 +362,7 @@ void RenderViewContextMenu::RecursivelyAppendExtensionItems( ExtensionMenuItem::List children = GetRelevantExtensionItems(item->children(), params_, profile_, can_cross_incognito); - if (children.size() == 0) { + if (children.empty()) { menu_model->AddItem(menu_id, title); } else { ui::SimpleMenuModel* submenu = new ui::SimpleMenuModel(this); @@ -720,7 +720,7 @@ void RenderViewContextMenu::AppendEditableItems() { // If word is misspelled, give option for "Add to dictionary" if (!params_.misspelled_word.empty()) { - if (params_.dictionary_suggestions.size() == 0) { + if (params_.dictionary_suggestions.empty()) { menu_model_.AddItem(0, l10n_util::GetStringUTF16( IDS_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS)); diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm index 8f49c6d..be2007b 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller_unittest.mm @@ -288,7 +288,7 @@ class BookmarkEditorControllerTreeTest : public CocoaTest { std::vector<const BookmarkNode*> nodes; BookmarkModel* model = browser_helper_.profile()->GetBookmarkModel(); model->GetNodesByURL(bb3_url_1_, &nodes); - if (nodes.size() == 0) + if (nodes.empty()) model->GetNodesByURL(bb3_url_2_, &nodes); DCHECK(nodes.size()); bookmark_bb_3_ = nodes[0]; diff --git a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc index a0c4b56..c34b68e 100644 --- a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc +++ b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc @@ -144,7 +144,7 @@ InstallDialogContent2::InstallDialogContent2( heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); AddChildView(heading_); - if (permissions.size() == 0) { + if (permissions.empty()) { right_column_width_ = kNoPermissionsRightColumnWidth; } else { right_column_width_ = kPermissionBoxWidth; diff --git a/chrome/common/extensions/update_manifest.cc b/chrome/common/extensions/update_manifest.cc index d2ceda7..4e1cdd5 100644 --- a/chrome/common/extensions/update_manifest.cc +++ b/chrome/common/extensions/update_manifest.cc @@ -140,7 +140,7 @@ static bool ParseSingleAppTag(xmlNode* app_node, xmlNs* xml_namespace, *error_detail = "Too many updatecheck tags on app (expecting only 1)."; return false; } - if (updates.size() == 0) { + if (updates.empty()) { *error_detail = "Missing updatecheck on app."; return false; } diff --git a/chrome/common/unix_domain_socket_posix.cc b/chrome/common/unix_domain_socket_posix.cc index 31f0135..7621b7e 100644 --- a/chrome/common/unix_domain_socket_posix.cc +++ b/chrome/common/unix_domain_socket_posix.cc @@ -139,7 +139,7 @@ ssize_t UnixDomainSocket::SendRecvMsg(int fd, } if (result_fd) { - if (fd_vector.size() == 0) { + if (fd_vector.empty()) { *result_fd = -1; } else { *result_fd = fd_vector[0]; diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index 6583250..e21d6e5 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -195,7 +195,7 @@ void StringArrayToMultiSZBytes(const std::vector<PendingMove>& strings, DCHECK(buffer); buffer->clear(); - if (strings.size() == 0) { + if (strings.empty()) { // Leave buffer empty if we have no strings. return; } diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index d143ffb..0f49ebc 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -372,7 +372,7 @@ bool AnotherUserHasDefaultBrowser(BrowserDistribution* dist, std::vector<std::wstring> v1, v2; base::SplitString(registry_chrome_exe, L'\\', &v1); base::SplitString(chrome_exe, L'\\', &v2); - if (v1.size() == 0 || v2.size() == 0 || v1.size() != v2.size()) + if (v1.empty() || v2.empty() || v1.size() != v2.size()) return false; // Now check that only one of the values within two '\' chars differ. diff --git a/chrome/tools/convert_dict/dic_reader.cc b/chrome/tools/convert_dict/dic_reader.cc index 0475eff..7b13abc 100644 --- a/chrome/tools/convert_dict/dic_reader.cc +++ b/chrome/tools/convert_dict/dic_reader.cc @@ -71,7 +71,7 @@ bool PopulateWordSet(WordSet* word_set, FILE* file, AffReader* aff_reader, std::vector<std::string> split; SplitDicLine(line, &split); - if (split.size() == 0 || split.size() > 2) { + if (split.empty() || split.size() > 2) { printf("Line %d has extra slashes in the %s file\n", line_number, file_type); return false; |