diff --git a/atom/app/uv_task_runner.cc b/atom/app/uv_task_runner.cc index 097cc3bcda1..7857ace3a2b 100644 --- a/atom/app/uv_task_runner.cc +++ b/atom/app/uv_task_runner.cc @@ -21,7 +21,7 @@ UvTaskRunner::~UvTaskRunner() { bool UvTaskRunner::PostDelayedTask(const tracked_objects::Location& from_here, const base::Closure& task, base::TimeDelta delay) { - uv_timer_t* timer = new uv_timer_t; + auto* timer = new uv_timer_t; timer->data = this; uv_timer_init(loop_, timer); uv_timer_start(timer, UvTaskRunner::OnTimeout, delay.InMilliseconds(), 0); diff --git a/atom/browser/api/atom_api_menu.cc b/atom/browser/api/atom_api_menu.cc index 5e66850c754..54a3d4e8132 100644 --- a/atom/browser/api/atom_api_menu.cc +++ b/atom/browser/api/atom_api_menu.cc @@ -21,7 +21,7 @@ namespace api { Menu::Menu(v8::Isolate* isolate) : model_(new AtomMenuModel(this)), - parent_(NULL) { + parent_(nullptr) { } Menu::~Menu() { diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 4a4ffba0c84..c898f5f1b33 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -241,10 +241,10 @@ void OnGetBackend(disk_cache::Backend** backend_ptr, } else if (action == Session::CacheAction::STATS) { base::StringPairs stats; (*backend_ptr)->GetStats(&stats); - for (size_t i = 0; i < stats.size(); ++i) { - if (stats[i].first == "Current size") { + for (const auto& stat : stats) { + if (stat.first == "Current size") { int current_size; - base::StringToInt(stats[i].second, ¤t_size); + base::StringToInt(stat.second, ¤t_size); RunCallbackInUI(callback, current_size); break; } @@ -266,7 +266,7 @@ void DoCacheActionInIO( // Call GetBackend and make the backend's ptr accessable in OnGetBackend. using BackendPtr = disk_cache::Backend*; - BackendPtr* backend_ptr = new BackendPtr(nullptr); + auto* backend_ptr = new BackendPtr(nullptr); net::CompletionCallback on_get_backend = base::Bind(&OnGetBackend, base::Owned(backend_ptr), action, callback); int rv = http_cache->GetBackend(backend_ptr, on_get_backend); diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 2b1d03dbd27..8622942668b 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -685,10 +685,10 @@ void WebContents::TitleWasSet(content::NavigationEntry* entry, void WebContents::DidUpdateFaviconURL( const std::vector& urls) { std::set unique_urls; - for (auto iter = urls.begin(); iter != urls.end(); ++iter) { - if (iter->icon_type != content::FaviconURL::FAVICON) + for (const auto& iter : urls) { + if (iter.icon_type != content::FaviconURL::FAVICON) continue; - const GURL& url = iter->icon_url; + const GURL& url = iter.icon_url; if (url.is_valid()) unique_urls.insert(url); } diff --git a/atom/browser/api/event.cc b/atom/browser/api/event.cc index 2554e4ad0da..8c60eda2471 100644 --- a/atom/browser/api/event.cc +++ b/atom/browser/api/event.cc @@ -12,8 +12,8 @@ namespace mate { Event::Event(v8::Isolate* isolate) - : sender_(NULL), - message_(NULL) { + : sender_(nullptr), + message_(nullptr) { Init(isolate); } @@ -31,8 +31,8 @@ void Event::SetSenderAndMessage(content::WebContents* sender, } void Event::WebContentsDestroyed() { - sender_ = NULL; - message_ = NULL; + sender_ = nullptr; + message_ = nullptr; } void Event::PreventDefault(v8::Isolate* isolate) { @@ -41,13 +41,13 @@ void Event::PreventDefault(v8::Isolate* isolate) { } bool Event::SendReply(const base::string16& json) { - if (message_ == NULL || sender_ == NULL) + if (message_ == nullptr || sender_ == nullptr) return false; AtomViewHostMsg_Message_Sync::WriteReplyParams(message_, json); bool success = sender_->Send(message_); - message_ = NULL; - sender_ = NULL; + message_ = nullptr; + sender_ = nullptr; return success; } diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index b933d1073bb..66c1bd8303a 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -32,7 +32,7 @@ void Erase(T* container, typename T::iterator iter) { } // static -AtomBrowserMainParts* AtomBrowserMainParts::self_ = NULL; +AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr; AtomBrowserMainParts::AtomBrowserMainParts() : fake_browser_process_(new BrowserProcess), diff --git a/atom/browser/atom_browser_main_parts_posix.cc b/atom/browser/atom_browser_main_parts_posix.cc index 2a0dddc4748..8c96f91bfe6 100644 --- a/atom/browser/atom_browser_main_parts_posix.cc +++ b/atom/browser/atom_browser_main_parts_posix.cc @@ -43,7 +43,7 @@ void GracefulShutdownHandler(int signal) { struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = SIG_DFL; - RAW_CHECK(sigaction(signal, &action, NULL) == 0); + RAW_CHECK(sigaction(signal, &action, nullptr) == 0); RAW_CHECK(g_pipe_pid == getpid()); RAW_CHECK(g_shutdown_pipe_write_fd != -1); @@ -171,7 +171,7 @@ void AtomBrowserMainParts::HandleSIGCHLD() { struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = SIGCHLDHandler; - CHECK_EQ(sigaction(SIGCHLD, &action, NULL), 0); + CHECK_EQ(sigaction(SIGCHLD, &action, nullptr), 0); } void AtomBrowserMainParts::HandleShutdownSignals() { @@ -211,15 +211,15 @@ void AtomBrowserMainParts::HandleShutdownSignals() { struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = SIGTERMHandler; - CHECK_EQ(sigaction(SIGTERM, &action, NULL), 0); + CHECK_EQ(sigaction(SIGTERM, &action, nullptr), 0); // Also handle SIGINT - when the user terminates the browser via Ctrl+C. If // the browser process is being debugged, GDB will catch the SIGINT first. action.sa_handler = SIGINTHandler; - CHECK_EQ(sigaction(SIGINT, &action, NULL), 0); + CHECK_EQ(sigaction(SIGINT, &action, nullptr), 0); // And SIGHUP, for when the terminal disappears. On shutdown, many Linux // distros send SIGHUP, SIGTERM, and then SIGKILL. action.sa_handler = SIGHUPHandler; - CHECK_EQ(sigaction(SIGHUP, &action, NULL), 0); + CHECK_EQ(sigaction(SIGHUP, &action, nullptr), 0); } } // namespace atom diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index c275d4aee74..f2f0ee8aec5 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -94,7 +94,7 @@ FileSystem CreateFileSystemStruct( } base::DictionaryValue* CreateFileSystemValue(const FileSystem& file_system) { - base::DictionaryValue* file_system_value = new base::DictionaryValue(); + auto* file_system_value = new base::DictionaryValue(); file_system_value->SetString("fileSystemName", file_system.file_system_name); file_system_value->SetString("rootURL", file_system.root_url); file_system_value->SetString("fileSystemPath", file_system.file_system_path); @@ -377,7 +377,7 @@ content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle( void CommonWebContentsDelegate::DevToolsSaveToFile( const std::string& url, const std::string& content, bool save_as) { base::FilePath path; - PathsMap::iterator it = saved_files_.find(url); + auto it = saved_files_.find(url); if (it != saved_files_.end() && !save_as) { path = it->second; } else { @@ -402,7 +402,7 @@ void CommonWebContentsDelegate::DevToolsSaveToFile( void CommonWebContentsDelegate::DevToolsAppendToFile( const std::string& url, const std::string& content) { - PathsMap::iterator it = saved_files_.find(url); + auto it = saved_files_.find(url); if (it == saved_files_.end()) return; @@ -435,8 +435,8 @@ void CommonWebContentsDelegate::DevToolsRequestFileSystems() { } base::ListValue file_system_value; - for (size_t i = 0; i < file_systems.size(); ++i) - file_system_value.Append(CreateFileSystemValue(file_systems[i])); + for (const auto& file_system : file_systems) + file_system_value.Append(CreateFileSystemValue(file_system)); web_contents_->CallClientFunction("DevToolsAPI.fileSystemsLoaded", &file_system_value, nullptr, nullptr); } @@ -610,9 +610,8 @@ void CommonWebContentsDelegate::OnDevToolsSearchCompleted( const std::string& file_system_path, const std::vector& file_paths) { base::ListValue file_paths_value; - for (std::vector::const_iterator it(file_paths.begin()); - it != file_paths.end(); ++it) { - file_paths_value.AppendString(*it); + for (const auto& file_path : file_paths) { + file_paths_value.AppendString(file_path); } base::FundamentalValue request_id_value(request_id); base::StringValue file_system_path_value(file_system_path); diff --git a/atom/browser/net/asar/asar_protocol_handler.cc b/atom/browser/net/asar/asar_protocol_handler.cc index 324f8339c8c..ffa2b3c9f28 100644 --- a/atom/browser/net/asar/asar_protocol_handler.cc +++ b/atom/browser/net/asar/asar_protocol_handler.cc @@ -22,7 +22,7 @@ net::URLRequestJob* AsarProtocolHandler::MaybeCreateJob( net::NetworkDelegate* network_delegate) const { base::FilePath full_path; net::FileURLToFilePath(request->url(), &full_path); - URLRequestAsarJob* job = new URLRequestAsarJob(request, network_delegate); + auto* job = new URLRequestAsarJob(request, network_delegate); job->Initialize(file_task_runner_, full_path); return job; } diff --git a/atom/browser/net/asar/url_request_asar_job.cc b/atom/browser/net/asar/url_request_asar_job.cc index 39e55a35cbc..2352668e179 100644 --- a/atom/browser/net/asar/url_request_asar_job.cc +++ b/atom/browser/net/asar/url_request_asar_job.cc @@ -111,7 +111,7 @@ void URLRequestAsarJob::Start() { if (rv != net::ERR_IO_PENDING) DidOpen(rv); } else if (type_ == TYPE_FILE) { - FileMetaInfo* meta_info = new FileMetaInfo(); + auto* meta_info = new FileMetaInfo(); file_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&URLRequestAsarJob::FetchMetaInfo, file_path_, @@ -183,7 +183,7 @@ bool URLRequestAsarJob::IsRedirectResponse(GURL* location, net::Filter* URLRequestAsarJob::SetupFilter() const { // Bug 9936 - .svgz files needs to be decompressed. return base::LowerCaseEqualsASCII(file_path_.Extension(), ".svgz") - ? net::Filter::GZipFactory() : NULL; + ? net::Filter::GZipFactory() : nullptr; } bool URLRequestAsarJob::GetMimeType(std::string* mime_type) const { @@ -224,7 +224,7 @@ int URLRequestAsarJob::GetResponseCode() const { void URLRequestAsarJob::GetResponseInfo(net::HttpResponseInfo* info) { std::string status("HTTP/1.1 200 OK"); - net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); + auto* headers = new net::HttpResponseHeaders(status); headers->AddHeader(atom::kCORSHeader); info->headers = headers; @@ -338,7 +338,7 @@ void URLRequestAsarJob::DidRead(scoped_refptr buf, int result) { DCHECK_GE(remaining_bytes_, 0); } - buf = NULL; + buf = nullptr; ReadRawDataComplete(result); } diff --git a/atom/browser/net/atom_url_request_job_factory.cc b/atom/browser/net/atom_url_request_job_factory.cc index d0caf183e91..7e2eb95149c 100644 --- a/atom/browser/net/atom_url_request_job_factory.cc +++ b/atom/browser/net/atom_url_request_job_factory.cc @@ -27,7 +27,7 @@ bool AtomURLRequestJobFactory::SetProtocolHandler( const std::string& scheme, std::unique_ptr protocol_handler) { if (!protocol_handler) { - ProtocolHandlerMap::iterator it = protocol_handler_map_.find(scheme); + auto it = protocol_handler_map_.find(scheme); if (it == protocol_handler_map_.end()) return false; @@ -66,7 +66,7 @@ ProtocolHandler* AtomURLRequestJobFactory::GetProtocolHandler( const std::string& scheme) const { DCHECK_CURRENTLY_ON(BrowserThread::IO); - ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); + auto it = protocol_handler_map_.find(scheme); if (it == protocol_handler_map_.end()) return nullptr; return it->second; @@ -87,7 +87,7 @@ net::URLRequestJob* AtomURLRequestJobFactory::MaybeCreateJobWithProtocolHandler( net::NetworkDelegate* network_delegate) const { DCHECK_CURRENTLY_ON(BrowserThread::IO); - ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); + auto it = protocol_handler_map_.find(scheme); if (it == protocol_handler_map_.end()) return nullptr; return it->second->MaybeCreateJob(request, network_delegate); diff --git a/atom/browser/net/url_request_async_asar_job.cc b/atom/browser/net/url_request_async_asar_job.cc index 1234bccf430..942f06233e3 100644 --- a/atom/browser/net/url_request_async_asar_job.cc +++ b/atom/browser/net/url_request_async_asar_job.cc @@ -40,7 +40,7 @@ void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr options) { void URLRequestAsyncAsarJob::GetResponseInfo(net::HttpResponseInfo* info) { std::string status("HTTP/1.1 200 OK"); - net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); + auto* headers = new net::HttpResponseHeaders(status); headers->AddHeader(kCORSHeader); info->headers = headers; diff --git a/atom/browser/net/url_request_buffer_job.cc b/atom/browser/net/url_request_buffer_job.cc index c713099c76a..70f46030817 100644 --- a/atom/browser/net/url_request_buffer_job.cc +++ b/atom/browser/net/url_request_buffer_job.cc @@ -72,7 +72,7 @@ void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) { status.append(" "); status.append(net::GetHttpReasonPhrase(status_code_)); status.append("\0\0", 2); - net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); + auto* headers = new net::HttpResponseHeaders(status); headers->AddHeader(kCORSHeader); diff --git a/atom/browser/net/url_request_string_job.cc b/atom/browser/net/url_request_string_job.cc index 59945e66db0..abec345e63d 100644 --- a/atom/browser/net/url_request_string_job.cc +++ b/atom/browser/net/url_request_string_job.cc @@ -31,7 +31,7 @@ void URLRequestStringJob::StartAsync(std::unique_ptr options) { void URLRequestStringJob::GetResponseInfo(net::HttpResponseInfo* info) { std::string status("HTTP/1.1 200 OK"); - net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); + auto* headers = new net::HttpResponseHeaders(status); headers->AddHeader(kCORSHeader); diff --git a/atom/browser/relauncher_mac.cc b/atom/browser/relauncher_mac.cc index ef26f8441df..ac4c874c560 100644 --- a/atom/browser/relauncher_mac.cc +++ b/atom/browser/relauncher_mac.cc @@ -43,7 +43,7 @@ void RelauncherSynchronizeWithParent() { struct kevent change = { 0 }; EV_SET(&change, parent_pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL); - if (kevent(kq.get(), &change, 1, NULL, 0, NULL) == -1) { + if (kevent(kq.get(), &change, 1, nullptr, 0, nullptr) == -1) { PLOG(ERROR) << "kevent (add)"; return; } @@ -58,7 +58,7 @@ void RelauncherSynchronizeWithParent() { // write above to complete. The parent process is now free to exit. Wait for // that to happen. struct kevent event; - int events = kevent(kq.get(), NULL, 0, &event, 1, NULL); + int events = kevent(kq.get(), nullptr, 0, &event, 1, nullptr); if (events != 1) { if (events < 0) { PLOG(ERROR) << "kevent (monitor)"; diff --git a/atom/browser/ui/accelerator_util.cc b/atom/browser/ui/accelerator_util.cc index 361cd88e05d..eb89bf0c35f 100644 --- a/atom/browser/ui/accelerator_util.cc +++ b/atom/browser/ui/accelerator_util.cc @@ -30,9 +30,9 @@ bool StringToAccelerator(const std::string& shortcut, // Now, parse it into an accelerator. int modifiers = ui::EF_NONE; ui::KeyboardCode key = ui::VKEY_UNKNOWN; - for (size_t i = 0; i < tokens.size(); i++) { + for (const auto& token : tokens) { bool shifted = false; - ui::KeyboardCode code = atom::KeyboardCodeFromStr(tokens[i], &shifted); + ui::KeyboardCode code = atom::KeyboardCodeFromStr(token, &shifted); if (shifted) modifiers |= ui::EF_SHIFT_DOWN; switch (code) { diff --git a/atom/browser/window_list.cc b/atom/browser/window_list.cc index b3bec5d08c1..83bf615aad2 100644 --- a/atom/browser/window_list.cc +++ b/atom/browser/window_list.cc @@ -17,7 +17,7 @@ base::LazyInstance>::Leaky WindowList::observers_ = LAZY_INSTANCE_INITIALIZER; // static -WindowList* WindowList::instance_ = NULL; +WindowList* WindowList::instance_ = nullptr; // static WindowList* WindowList::GetInstance() { @@ -70,8 +70,8 @@ void WindowList::RemoveObserver(WindowListObserver* observer) { // static void WindowList::CloseAllWindows() { WindowVector windows = GetInstance()->windows_; - for (size_t i = 0; i < windows.size(); ++i) - windows[i]->Close(); + for (const auto& window : windows) + window->Close(); } WindowList::WindowList() { diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index 14500496ebf..80275e26a7f 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -63,10 +63,10 @@ float GetScaleFactorFromPath(const base::FilePath& path) { // We don't try to convert string to float here because it is very very // expensive. - for (unsigned i = 0; i < node::arraysize(kScaleFactorPairs); ++i) { - if (base::EndsWith(filename, kScaleFactorPairs[i].name, + for (const auto& kScaleFactorPair : kScaleFactorPairs) { + if (base::EndsWith(filename, kScaleFactorPair.name, base::CompareCase::INSENSITIVE_ASCII)) - return kScaleFactorPairs[i].scale; + return kScaleFactorPair.scale; } return 1.0f; diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index 599fc674989..b5a51ad507e 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -25,7 +25,7 @@ namespace { struct DummyClass { bool crash; }; void Crash() { - static_cast(NULL)->crash = true; + static_cast(nullptr)->crash = true; } void Hang() { diff --git a/atom/common/asar/archive.cc b/atom/common/asar/archive.cc index c2306c3c8f3..e622effe5d3 100644 --- a/atom/common/asar/archive.cc +++ b/atom/common/asar/archive.cc @@ -41,7 +41,7 @@ bool GetFilesNode(const base::DictionaryValue* root, // Test for symbol linked directory. std::string link; if (dir->GetStringWithoutPathExpansion("link", &link)) { - const base::DictionaryValue* linked_node = NULL; + const base::DictionaryValue* linked_node = nullptr; if (!GetNodeFromPath(link, root, &linked_node)) return false; dir = linked_node; @@ -60,7 +60,7 @@ bool GetChildNode(const base::DictionaryValue* root, return true; } - const base::DictionaryValue* files = NULL; + const base::DictionaryValue* files = nullptr; return GetFilesNode(root, dir, &files) && files->GetDictionaryWithoutPathExpansion(name, out); } @@ -78,7 +78,7 @@ bool GetNodeFromPath(std::string path, for (size_t delimiter_position = path.find_first_of(kSeparators); delimiter_position != std::string::npos; delimiter_position = path.find_first_of(kSeparators)) { - const base::DictionaryValue* child = NULL; + const base::DictionaryValue* child = nullptr; if (!GetChildNode(root, path.substr(0, delimiter_position), dir, &child)) return false; diff --git a/atom/common/native_mate_converters/callback.cc b/atom/common/native_mate_converters/callback.cc index 8bf5c459b0a..dc6d30fd23d 100644 --- a/atom/common/native_mate_converters/callback.cc +++ b/atom/common/native_mate_converters/callback.cc @@ -123,7 +123,7 @@ v8::Local CreateFunctionFromTranslater( v8::Local call_translater = v8::Local::New(isolate, g_call_translater); - TranslaterHolder* holder = new TranslaterHolder; + auto* holder = new TranslaterHolder; holder->translater = translater; return BindFunctionWith(isolate, isolate->GetCurrentContext(), diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index ff96b727e02..37e09aec575 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/atom/common/native_mate_converters/v8_value_converter.cc @@ -55,7 +55,7 @@ class V8ValueConverter::FromV8ValueState { // hash. Different hash obviously means different objects, but two objects // in a couple of thousands could have the same identity hash. std::pair range = unique_map_.equal_range(hash); - for (Iterator it = range.first; it != range.second; ++it) { + for (auto it = range.first; it != range.second; ++it) { // Operator == for handles actually compares the underlying objects. if (it->second == handle) return false; @@ -162,7 +162,7 @@ v8::Local V8ValueConverter::ToV8Array( v8::Local result(v8::Array::New(isolate, val->GetSize())); for (size_t i = 0; i < val->GetSize(); ++i) { - const base::Value* child = NULL; + const base::Value* child = nullptr; CHECK(val->Get(i, &child)); v8::Local child_v8 = ToV8ValueImpl(isolate, child); @@ -214,7 +214,7 @@ base::Value* V8ValueConverter::FromV8ValueImpl( FromV8ValueState::Level state_level(state); if (state->HasReachedMaxRecursionDepth()) - return NULL; + return nullptr; if (val->IsNull()) return base::Value::CreateNullValue().release(); @@ -235,7 +235,7 @@ base::Value* V8ValueConverter::FromV8ValueImpl( if (val->IsUndefined()) // JSON.stringify ignores undefined. - return NULL; + return nullptr; if (val->IsDate()) { v8::Date* date = v8::Date::Cast(*val); @@ -265,7 +265,7 @@ base::Value* V8ValueConverter::FromV8ValueImpl( if (val->IsFunction()) { if (!function_allowed_) // JSON.stringify refuses to convert function(){}. - return NULL; + return nullptr; return FromV8Object(val->ToObject(), state, isolate); } @@ -278,7 +278,7 @@ base::Value* V8ValueConverter::FromV8ValueImpl( } LOG(ERROR) << "Unexpected v8 value type encountered."; - return NULL; + return nullptr; } base::Value* V8ValueConverter::FromV8Array( @@ -295,7 +295,7 @@ base::Value* V8ValueConverter::FromV8Array( val->CreationContext() != isolate->GetCurrentContext()) scope.reset(new v8::Context::Scope(val->CreationContext())); - base::ListValue* result = new base::ListValue(); + auto* result = new base::ListValue(); // Only fields with integer keys are carried over to the ListValue. for (uint32_t i = 0; i < val->Length(); ++i) { diff --git a/atom/common/node_bindings_mac.cc b/atom/common/node_bindings_mac.cc index 9e61d27f496..cbcbdba3605 100644 --- a/atom/common/node_bindings_mac.cc +++ b/atom/common/node_bindings_mac.cc @@ -54,7 +54,8 @@ void NodeBindingsMac::PollEvents() { // Wait for new libuv events. int r; do { - r = select(fd + 1, &readset, NULL, NULL, timeout == -1 ? NULL : &tv); + r = select(fd + 1, &readset, nullptr, nullptr, + timeout == -1 ? nullptr : &tv); } while (r == -1 && errno == EINTR); } diff --git a/atom/renderer/api/atom_api_renderer_ipc.cc b/atom/renderer/api/atom_api_renderer_ipc.cc index a82562f9361..49f917292bb 100644 --- a/atom/renderer/api/atom_api_renderer_ipc.cc +++ b/atom/renderer/api/atom_api_renderer_ipc.cc @@ -20,11 +20,11 @@ namespace { RenderView* GetCurrentRenderView() { WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); if (!frame) - return NULL; + return nullptr; WebView* view = frame->view(); if (!view) - return NULL; // can happen during closing. + return nullptr; // can happen during closing. return RenderView::FromWebView(view); } @@ -33,7 +33,7 @@ void Send(mate::Arguments* args, const base::string16& channel, const base::ListValue& arguments) { RenderView* render_view = GetCurrentRenderView(); - if (render_view == NULL) + if (render_view == nullptr) return; bool success = render_view->Send(new AtomViewHostMsg_Message( @@ -49,7 +49,7 @@ base::string16 SendSync(mate::Arguments* args, base::string16 json; RenderView* render_view = GetCurrentRenderView(); - if (render_view == NULL) + if (render_view == nullptr) return json; IPC::SyncMessage* message = new AtomViewHostMsg_Message_Sync( diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index 0b291d3b552..dce72b58095 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -39,7 +39,7 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback { explicit ScriptExecutionCallback(const CompletionCallback& callback) : callback_(callback) {} - ~ScriptExecutionCallback() {} + ~ScriptExecutionCallback() override {} void completed( const blink::WebVector>& result) override { diff --git a/atom/renderer/atom_render_view_observer.cc b/atom/renderer/atom_render_view_observer.cc index 7ee93efb39b..45a41eef8ac 100644 --- a/atom/renderer/atom_render_view_observer.cc +++ b/atom/renderer/atom_render_view_observer.cc @@ -132,10 +132,10 @@ void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) { blink::WebVector webregions = frame->document().draggableRegions(); std::vector regions; - for (size_t i = 0; i < webregions.size(); ++i) { + for (const auto& webregion : webregions) { DraggableRegion region; - region.bounds = webregions[i].bounds; - region.draggable = webregions[i].draggable; + region.bounds = webregion.bounds; + region.draggable = webregion.draggable; regions.push_back(region); } Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions)); diff --git a/atom/utility/atom_content_utility_client.cc b/atom/utility/atom_content_utility_client.cc index aff567fbcaa..8d4ccf62893 100644 --- a/atom/utility/atom_content_utility_client.cc +++ b/atom/utility/atom_content_utility_client.cc @@ -58,8 +58,7 @@ bool AtomContentUtilityClient::OnMessageReceived( IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() - for (Handlers::iterator it = handlers_.begin(); - !handled && it != handlers_.end(); ++it) { + for (auto it = handlers_.begin(); !handled && it != handlers_.end(); ++it) { handled = (*it)->OnMessageReceived(message); }