Browse Source

Replace "size()" with "empty()".

Haojian Wu 8 years ago
parent
commit
00693ba075

+ 1 - 1
atom/app/atom_content_client.cc

@@ -44,7 +44,7 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
 
   std::vector<std::string> flash_version_numbers = base::SplitString(
       version, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
-  if (flash_version_numbers.size() < 1)
+  if (flash_version_numbers.empty())
     flash_version_numbers.push_back("11");
   // |SplitString()| puts in an empty string given an empty string. :(
   else if (flash_version_numbers[0].empty())

+ 1 - 1
atom/browser/api/atom_api_app.cc

@@ -427,7 +427,7 @@ void OnClientCertificateSelected(
 
   auto certs = net::X509Certificate::CreateCertificateListFromBytes(
       data.c_str(), data.length(), net::X509Certificate::FORMAT_AUTO);
-  if (certs.size() > 0)
+  if (!certs.empty())
     delegate->ContinueWithCertificate(certs[0].get());
 }
 

+ 1 - 1
atom/browser/api/atom_api_auto_updater.cc

@@ -88,7 +88,7 @@ void AutoUpdater::SetFeedURL(const std::string& url, mate::Arguments* args) {
 void AutoUpdater::QuitAndInstall() {
   // If we don't have any window then quitAndInstall immediately.
   WindowList* window_list = WindowList::GetInstance();
-  if (window_list->size() == 0) {
+  if (window_list->empty()) {
     auto_updater::AutoUpdater::QuitAndInstall();
     return;
   }

+ 2 - 2
atom/browser/browser.cc

@@ -44,7 +44,7 @@ void Browser::Quit() {
     return;
 
   atom::WindowList* window_list = atom::WindowList::GetInstance();
-  if (window_list->size() == 0)
+  if (window_list->empty())
     NotifyAndShutdown();
 
   window_list->CloseAllWindows();
@@ -66,7 +66,7 @@ void Browser::Exit(mate::Arguments* args) {
 
     // Must destroy windows before quitting, otherwise bad things can happen.
     atom::WindowList* window_list = atom::WindowList::GetInstance();
-    if (window_list->size() == 0) {
+    if (window_list->empty()) {
       Shutdown();
     } else {
       // Unlike Quit(), we do not ask to close window, but destroy the window

+ 1 - 1
atom/browser/node_debugger.cc

@@ -164,7 +164,7 @@ void NodeDebugger::DidRead(net::test_server::StreamListenSocket* socket,
   buffer_.append(data, len);
 
   do {
-    if (buffer_.size() == 0)
+    if (buffer_.empty())
       return;
 
     // Read the "Content-Length" header.

+ 1 - 1
atom/browser/ui/cocoa/atom_touch_bar.mm

@@ -319,7 +319,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
 - (void)updateColorPicker:(NSColorPickerTouchBarItem*)item
              withSettings:(const mate::PersistentDictionary&)settings {
   std::vector<std::string> colors;
-  if (settings.Get("availableColors", &colors) && colors.size() > 0) {
+  if (settings.Get("availableColors", &colors) && !colors.empty()) {
     NSColorList* color_list  = [[[NSColorList alloc] initWithName:@""] autorelease];
     for (size_t i = 0; i < colors.size(); ++i) {
       [color_list insertColor:[self colorFromHexColorString:colors[i]]

+ 1 - 1
atom/browser/window_list.cc

@@ -46,7 +46,7 @@ void WindowList::RemoveWindow(NativeWindow* window) {
   for (WindowListObserver& observer : observers_.Get())
     observer.OnWindowRemoved(window);
 
-  if (windows.size() == 0) {
+  if (windows.empty()) {
     for (WindowListObserver& observer : observers_.Get())
       observer.OnWindowAllClosed();
   }