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 | |
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
59 files changed, 76 insertions, 76 deletions
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc index 6fd6440..de8e414 100644 --- a/base/command_line_unittest.cc +++ b/base/command_line_unittest.cc @@ -109,7 +109,7 @@ TEST(CommandLineTest, EmptyString) { EXPECT_TRUE(cl.GetProgram().empty()); #elif defined(OS_POSIX) CommandLine cl(0, NULL); - EXPECT_TRUE(cl.argv().size() == 0); + EXPECT_EQ(0U, cl.argv().size()); #endif EXPECT_EQ(0U, cl.args().size()); } diff --git a/base/crypto/encryptor_nss.cc b/base/crypto/encryptor_nss.cc index 6256d7a..3b9f7f3 100644 --- a/base/crypto/encryptor_nss.cc +++ b/base/crypto/encryptor_nss.cc @@ -85,7 +85,7 @@ bool Encryptor::Encrypt(const std::string& plaintext, std::string* ciphertext) { } bool Encryptor::Decrypt(const std::string& ciphertext, std::string* plaintext) { - if (ciphertext.size() == 0) + if (ciphertext.empty()) return false; ScopedPK11Context context(PK11_CreateContextBySymKey(CKM_AES_CBC_PAD, diff --git a/base/file_path.cc b/base/file_path.cc index 907a412..32217f2 100644 --- a/base/file_path.cc +++ b/base/file_path.cc @@ -251,7 +251,7 @@ bool FilePath::AppendRelativePath(const FilePath& child, if (parent_components.size() >= child_components.size()) return false; - if (parent_components.size() == 0) + if (parent_components.empty()) return false; std::vector<StringType>::const_iterator parent_comp = diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 7e4c3a9..8df0d27 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -633,7 +633,7 @@ FileEnumerator::FileEnumerator(const FilePath& root_path, // The Windows version of this code appends the pattern to the root_path, // potentially only matching against items in the top-most directory. // Do the same here. - if (pattern.size() == 0) + if (pattern.empty()) pattern_ = FilePath::StringType(); pending_paths_.push(root_path); } diff --git a/base/mime_util_xdg.cc b/base/mime_util_xdg.cc index 5215d01..4dd7a3e 100644 --- a/base/mime_util_xdg.cc +++ b/base/mime_util_xdg.cc @@ -525,7 +525,7 @@ FilePath LookupIconInDefaultTheme(const std::string& icon_name, int size) { EnsureUpdated(); MimeUtilConstants* constants = MimeUtilConstants::GetInstance(); std::map<std::string, IconTheme*>* icon_themes = constants->icon_themes_; - if (icon_themes->size() == 0) + if (icon_themes->empty()) InitDefaultThemes(); FilePath icon_path; diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc index 9a5f5a7..cf93c05 100644 --- a/base/process_util_posix.cc +++ b/base/process_util_posix.cc @@ -451,7 +451,7 @@ char** AlterEnvironment(const environment_vector& changes, // Now handle new elements for (environment_vector::const_iterator j = changes.begin(); j != changes.end(); j++) { - if (j->second.size() == 0) + if (j->second.empty()) continue; bool found = false; diff --git a/base/string_util.cc b/base/string_util.cc index ce12705..4af3ed9 100644 --- a/base/string_util.cc +++ b/base/string_util.cc @@ -804,7 +804,7 @@ size_t Tokenize(const base::StringPiece& str, template<typename STR> static STR JoinStringT(const std::vector<STR>& parts, typename STR::value_type sep) { - if (parts.size() == 0) return STR(); + if (parts.empty()) return STR(); STR result(parts[0]); typename std::vector<STR>::const_iterator iter = parts.begin(); 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; diff --git a/chrome_frame/policy_settings.cc b/chrome_frame/policy_settings.cc index a6741a3..97c0810 100644 --- a/chrome_frame/policy_settings.cc +++ b/chrome_frame/policy_settings.cc @@ -110,7 +110,7 @@ void PolicySettings::ReadContentTypeSetting( sub_key += ASCIIToWide(policy::key::kChromeFrameContentTypes); content_type_list->clear(); - for (int i = 0; i < arraysize(kRootKeys) && content_type_list->size() == 0; + for (int i = 0; i < arraysize(kRootKeys) && content_type_list->empty(); ++i) { EnumerateKeyValues(kRootKeys[i], sub_key.c_str(), content_type_list); } diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc index 3ff76c2..81a3d88 100644 --- a/chrome_frame/urlmon_url_request.cc +++ b/chrome_frame/urlmon_url_request.cc @@ -1248,7 +1248,7 @@ void UrlmonUrlRequestManager::AddPrivacyDataForUrl( bool fire_privacy_event = false; - if (privacy_info_.privacy_records.size() == 0) + if (privacy_info_.privacy_records.empty()) flags |= PRIVACY_URLISTOPLEVEL; if (!privacy_info_.privacy_impacted) { diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc index 8d05790..1b36fba 100644 --- a/content/browser/renderer_host/render_sandbox_host_linux.cc +++ b/content/browser/renderer_host/render_sandbox_host_linux.cc @@ -120,7 +120,7 @@ class SandboxIPCProcess { << "Sandbox host message is larger than kMaxFontFamilyLength"; return; } - if (fds.size() == 0) + if (fds.empty()) return; Pickle pickle(buf, len); diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 076d3e0..1c3024a 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -1239,7 +1239,7 @@ void RenderWidgetHost::AccessibilityNotificationsAck() { } void RenderWidgetHost::ProcessKeyboardEventAck(int type, bool processed) { - if (key_queue_.size() == 0) { + if (key_queue_.empty()) { LOG(ERROR) << "Got a KeyEvent back from the renderer but we " << "don't seem to have sent it to the renderer!"; } else if (key_queue_.front().type != type) { diff --git a/courgette/adjustment_method_2.cc b/courgette/adjustment_method_2.cc index e3ca315..4a3d1c1 100644 --- a/courgette/adjustment_method_2.cc +++ b/courgette/adjustment_method_2.cc @@ -988,10 +988,10 @@ class AssignmentProblem { if (single_use_score > 0) { size_t n = single_use_pattern_queue_.erase(pattern); LOG_ASSERT(n == 1); - } else if (pattern->program_histogram_.size() == 0 && - pattern->model_histogram_.size() == 0) { + } else if (pattern->program_histogram_.empty() && + pattern->model_histogram_.empty()) { NOTREACHED(); // Should not come back to life. - } else if (pattern->program_histogram_.size() == 0) { + } else if (pattern->program_histogram_.empty()) { // Useless pattern. } else { active_non_single_use_patterns_.erase(pattern); @@ -1003,9 +1003,9 @@ class AssignmentProblem { int single_use_score = SingleUseScore(pattern); if (single_use_score > 0) { single_use_pattern_queue_.insert(pattern); - } else if (pattern->program_histogram_.size() == 0 && - pattern->model_histogram_.size() == 0) { - } else if (pattern->program_histogram_.size() == 0) { + } else if (pattern->program_histogram_.empty() && + pattern->model_histogram_.empty()) { + } else if (pattern->program_histogram_.empty()) { // Useless pattern. } else { active_non_single_use_patterns_.insert(pattern); diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc index ee89845..a6b1cb4 100644 --- a/ipc/ipc_channel_posix.cc +++ b/ipc/ipc_channel_posix.cc @@ -86,7 +86,7 @@ class PipeMap { ~PipeMap() { // Shouldn't have left over pipes. - DCHECK(map_.size() == 0); + DCHECK(map_.empty()); } // Lookup a given channel id. Return -1 if not found. diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 17941aa0..9c1752d 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -413,7 +413,7 @@ template <> struct ParamTraits<std::vector<unsigned char> > { typedef std::vector<unsigned char> param_type; static void Write(Message* m, const param_type& p) { - if (p.size() == 0) { + if (p.empty()) { m->WriteData(NULL, 0); } else { m->WriteData(reinterpret_cast<const char*>(&p.front()), @@ -439,7 +439,7 @@ template <> struct ParamTraits<std::vector<char> > { typedef std::vector<char> param_type; static void Write(Message* m, const param_type& p) { - if (p.size() == 0) { + if (p.empty()) { m->WriteData(NULL, 0); } else { m->WriteData(&p.front(), static_cast<int>(p.size())); diff --git a/net/base/dnssec_chain_verifier.cc b/net/base/dnssec_chain_verifier.cc index e6d31ee..6e68365 100644 --- a/net/base/dnssec_chain_verifier.cc +++ b/net/base/dnssec_chain_verifier.cc @@ -489,7 +489,7 @@ bool DNSSECChainVerifier::ReadDNSKEYs(std::vector<base::StringPiece>* out, base::StringPiece key; if (!VariableLength16(&key)) return false; - if (key.size() == 0) { + if (key.empty()) { if (!is_root) return false; key = base::StringPiece(reinterpret_cast<const char*>(kRootKey), @@ -597,7 +597,7 @@ DNSSECChainVerifier::Error DNSSECChainVerifier::EnterZone( if (!ReadAheadKey(&key, entry_key)) return BAD_DATA; - if (zone.size() == 1 && key.size() == 0) { + if (zone.size() == 1 && key.empty()) { // If a key is omitted in the root zone then it's the root key. key = base::StringPiece(reinterpret_cast<const char*>(kRootKey), sizeof(kRootKey)); @@ -609,7 +609,7 @@ DNSSECChainVerifier::Error DNSSECChainVerifier::EnterZone( if (!ReadDNSKEYs(&dnskeys, zone.size() == 1)) return BAD_DATA; - if (sig.size() == 0) { + if (sig.empty()) { // An omitted signature on the keys means that only the entry key is used. if (dnskeys.size() > 1 || entry_key != 0) return BAD_DATA; diff --git a/net/base/x509_certificate.cc b/net/base/x509_certificate.cc index 6469537..8b7014b 100644 --- a/net/base/x509_certificate.cc +++ b/net/base/x509_certificate.cc @@ -184,7 +184,7 @@ static X509Certificate::OSCertHandle CreateOSCert(base::StringPiece der_cert) { // static X509Certificate* X509Certificate::CreateFromDERCertChain( const std::vector<base::StringPiece>& der_certs) { - if (der_certs.size() == 0) + if (der_certs.empty()) return NULL; X509Certificate::OSCertHandles intermediate_ca_certs; diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc index 3cc1e08..f9023fd 100644 --- a/net/base/x509_certificate_mac.cc +++ b/net/base/x509_certificate_mac.cc @@ -544,7 +544,7 @@ X509Certificate* X509Certificate::CreateSelfSigned( cssm_subject_names.push_back(cssm_subject_name); } - if (cssm_subject_names.size() == 0) { + if (cssm_subject_names.empty()) { DLOG(ERROR) << "cssm_subject_names.size() == 0. Input: " << subject; return NULL; } diff --git a/net/disk_cache/mem_entry_impl.cc b/net/disk_cache/mem_entry_impl.cc index 30599f4..2b37f36 100644 --- a/net/disk_cache/mem_entry_impl.cc +++ b/net/disk_cache/mem_entry_impl.cc @@ -75,7 +75,7 @@ void MemEntryImpl::InternalDoom() { if (i->second != this) i->second->Doom(); } - DCHECK(children_->size() == 0); + DCHECK(children_->empty()); } } else { // If this is a child entry, detach it from the parent. diff --git a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp index fcaff60..0cf9562 100644 --- a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp +++ b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp @@ -277,7 +277,7 @@ int nsPKCS12Blob_Import(PK11SlotInfo* slot, // zero length SECItem. // We try both variations, zero length item and empty string, // without giving a user prompt when trying the different empty password flavors. - if (rv == net::ERR_PKCS12_IMPORT_BAD_PASSWORD && password.size() == 0) { + if (rv == net::ERR_PKCS12_IMPORT_BAD_PASSWORD && password.empty()) { rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, true, slot); } diff --git a/net/tools/flip_server/split.cc b/net/tools/flip_server/split.cc index 6ab50cf..2d8659a 100644 --- a/net/tools/flip_server/split.cc +++ b/net/tools/flip_server/split.cc @@ -19,7 +19,7 @@ void SplitStringPieceToVector(const base::StringPiece& full, std::vector<base::StringPiece>* vec, bool omit_empty_strings) { vec->clear(); - if (full.size() == 0 || delim[0] == '\0') + if (full.empty() || delim[0] == '\0') return; if (delim[1] == '\0') { diff --git a/net/tools/tld_cleanup/tld_cleanup.cc b/net/tools/tld_cleanup/tld_cleanup.cc index be723c4..7a8aea8f 100644 --- a/net/tools/tld_cleanup/tld_cleanup.cc +++ b/net/tools/tld_cleanup/tld_cleanup.cc @@ -106,13 +106,13 @@ NormalizeResult NormalizeRule(std::string* domain, Rule* rule) { // Strip single leading and trailing dots. if (domain->at(0) == '.') domain->erase(0, 1); - if (domain->size() == 0) { + if (domain->empty()) { LOG(WARNING) << "Ignoring empty rule"; return kWarning; } if (domain->at(domain->size() - 1) == '.') domain->erase(domain->size() - 1, 1); - if (domain->size() == 0) { + if (domain->empty()) { LOG(WARNING) << "Ignoring empty rule"; return kWarning; } @@ -126,7 +126,7 @@ NormalizeResult NormalizeRule(std::string* domain, Rule* rule) { domain->erase(0, 2); rule->wildcard = true; } - if (domain->size() == 0) { + if (domain->empty()) { LOG(WARNING) << "Ignoring empty rule"; return kWarning; } diff --git a/o3d/core/cross/gl/effect_gl.cc b/o3d/core/cross/gl/effect_gl.cc index 71ce602..755d80a 100644 --- a/o3d/core/cross/gl/effect_gl.cc +++ b/o3d/core/cross/gl/effect_gl.cc @@ -378,7 +378,7 @@ ParamTexture* EffectGL::GetTextureParamFromCgSampler( DLOG_ASSERT(cgGetParameterType(cg_sampler) != CG_SAMPLER); String sampler_name = cgGetParameterName(cg_sampler); String param_name = GetTextureNameFromSamplerParamName(sampler_name); - if (param_name.size() == 0) { + if (param_name.empty()) { // Sampler has no texture associated with it. return NULL; } diff --git a/o3d/core/cross/gpu2d/interval_tree_test.cc b/o3d/core/cross/gpu2d/interval_tree_test.cc index 29118b2..95b48d0 100644 --- a/o3d/core/cross/gpu2d/interval_tree_test.cc +++ b/o3d/core/cross/gpu2d/interval_tree_test.cc @@ -177,9 +177,9 @@ InsertionAndDeletionTest(unsigned seed, int tree_size) { // Now randomly add or remove elements. for (int i = 0; i < 2 * tree_size; i++) { bool add = false; - if (added_elements.size() == 0) { + if (added_elements.empty()) { add = true; - } else if (removed_elements.size() == 0) { + } else if (removed_elements.empty()) { add = false; } else { add = (NextRandom(2) == 1); diff --git a/o3d/core/cross/gpu2d/path_processor.cc b/o3d/core/cross/gpu2d/path_processor.cc index 756ae48..6e50e9e 100644 --- a/o3d/core/cross/gpu2d/path_processor.cc +++ b/o3d/core/cross/gpu2d/path_processor.cc @@ -1105,7 +1105,7 @@ void PathProcessor::SubdivideCurves() { std::vector<SweepInterval> overlaps; for (int cur_iter = 0; cur_iter < kMaxIter; ++cur_iter) { - if (cur_segments.size() == 0) { + if (cur_segments.empty()) { // Done break; } @@ -1224,7 +1224,7 @@ void PathProcessor::SubdivideCurvesSlow() { const int kMaxIter = 5; for (int cur_iter = 0; cur_iter < kMaxIter; ++cur_iter) { - if (cur_segments.size() == 0) { + if (cur_segments.empty()) { // Done break; } diff --git a/o3d/plugin/cross/stream_manager.cc b/o3d/plugin/cross/stream_manager.cc index 48da1c1..783b114 100644 --- a/o3d/plugin/cross/stream_manager.cc +++ b/o3d/plugin/cross/stream_manager.cc @@ -310,7 +310,7 @@ bool StreamManager::NPDownloadStream::URLNotify(NPReason reason) { // Note that the streaming case (NP_NORMAL) does not get a file // so we can't check its size if ((reason != NPRES_DONE) || - (stream_type_ != NP_NORMAL && file_.size() == 0)) { + (stream_type_ != NP_NORMAL && file_.empty())) { // finished_callback should only be called once. finished_callback_->Run(this, false, "", ""); finished_callback_.reset(NULL); diff --git a/o3d/plugin/idl/bounding_box.idl b/o3d/plugin/idl/bounding_box.idl index 9a5cc82..23e5d88 100644 --- a/o3d/plugin/idl/bounding_box.idl +++ b/o3d/plugin/idl/bounding_box.idl @@ -135,7 +135,7 @@ class BoundingBox { void* plugin_data, o3d::BoundingBox* _this, const std::vector<std::vector<float> >& values) { - if (values.size() == 0) { + if (values.empty()) { *_this = o3d::BoundingBox(); } else if (values.size() != 2) { o3d::ServiceLocator* service_locator = diff --git a/o3d/utils/cross/text_reader.cc b/o3d/utils/cross/text_reader.cc index dccbffa..c6f1e56 100644 --- a/o3d/utils/cross/text_reader.cc +++ b/o3d/utils/cross/text_reader.cc @@ -48,7 +48,7 @@ TextReader::~TextReader() { } int TextReader::TestForEndOfLine(const std::string& eol) { - if (eol.size() == 0) { + if (eol.empty()) { return 0; } if (eol[0] == kLinefeed) { diff --git a/remoting/base/tracer.cc b/remoting/base/tracer.cc index 25ed244..a534deb 100644 --- a/remoting/base/tracer.cc +++ b/remoting/base/tracer.cc @@ -72,7 +72,7 @@ class OutputLogger { TraceBuffer* buffer = NULL; { base::AutoLock l(lock_); - if (buffers_.size() == 0) { + if (buffers_.empty()) { wake_.Wait(); } // Check again since we might have woken for a stop signal. diff --git a/ui/gfx/codec/jpeg_codec_unittest.cc b/ui/gfx/codec/jpeg_codec_unittest.cc index ca8335f..7a8756a 100644 --- a/ui/gfx/codec/jpeg_codec_unittest.cc +++ b/ui/gfx/codec/jpeg_codec_unittest.cc @@ -76,7 +76,7 @@ static double AveragePixelDelta(const std::vector<unsigned char>& a, // if the sizes are different, say the average difference is the maximum if (a.size() != b.size()) return 255.0; - if (a.size() == 0) + if (a.empty()) return 0; // prevent divide by 0 below double acc = 0.0; diff --git a/webkit/fileapi/file_system_path_manager.cc b/webkit/fileapi/file_system_path_manager.cc index 8ef0631..61aa49e 100644 --- a/webkit/fileapi/file_system_path_manager.cc +++ b/webkit/fileapi/file_system_path_manager.cc @@ -290,7 +290,7 @@ bool FileSystemPathManager::IsAllowedScheme(const GURL& url) const { // static bool FileSystemPathManager::IsRestrictedFileName(const FilePath& filename) { - if (filename.value().size() == 0) + if (filename.value().empty()) return false; if (IsWhitespace(filename.value()[filename.value().size() - 1]) || diff --git a/webkit/plugins/npapi/plugin_group.cc b/webkit/plugins/npapi/plugin_group.cc index 4b61baa..52f7c41 100644 --- a/webkit/plugins/npapi/plugin_group.cc +++ b/webkit/plugins/npapi/plugin_group.cc @@ -488,7 +488,7 @@ bool PluginGroup::RequiresAuthorization() const { } bool PluginGroup::IsEmpty() const { - return web_plugin_infos_.size() == 0; + return web_plugin_infos_.empty(); } void PluginGroup::DisableOutdatedPlugins() { diff --git a/webkit/tools/test_shell/accessibility_ui_element.cc b/webkit/tools/test_shell/accessibility_ui_element.cc index e1a9d1c..78988a9 100644 --- a/webkit/tools/test_shell/accessibility_ui_element.cc +++ b/webkit/tools/test_shell/accessibility_ui_element.cc @@ -362,7 +362,7 @@ void AccessibilityUIElement::StringForRangeCallback( void AccessibilityUIElement::ChildAtIndexCallback( const CppArgumentList& args, CppVariant* result) { - if (args.size() == 0 || !args[0].isNumber()) { + if (args.empty() || !args[0].isNumber()) { result->SetNull(); return; } diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index d001212..7d32c18 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -188,7 +188,7 @@ void TestShell::PlatformShutdown() { [*it release]; } // assert if we have anything left over, that would be bad. - DCHECK(window_map_.Get().size() == 0); + DCHECK(window_map_.Get().empty()); // Dump the pasteboards we built up. [DumpRenderTreePasteboard releaseLocalPasteboards]; |