refactor: run clang-tidy (#20231)

* refactor: clang-tidy modernize-use-nullptr

* refactor: clang-tidy modernize-use-equals-default

* refactor: clang-tidy modernize-make-unique

* refactor: omit nullptr arg from unique_ptr.reset()

As per comment by @miniak
This commit is contained in:
Charles Kerr 2019-09-16 18:12:00 -04:00 committed by GitHub
parent 660e566201
commit 2b316f3843
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
93 changed files with 261 additions and 223 deletions

View file

@ -2,6 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <memory>
#include "shell/browser/ui/file_dialog.h"
#include "shell/browser/ui/util_gtk.h"
@ -57,7 +59,7 @@ class FileChooserDialog {
confirm_text = gtk_util::kSaveLabel;
dialog_ = gtk_file_chooser_dialog_new(
settings.title.c_str(), NULL, action, gtk_util::kCancelLabel,
settings.title.c_str(), nullptr, action, gtk_util::kCancelLabel,
GTK_RESPONSE_CANCEL, confirm_text, GTK_RESPONSE_ACCEPT, NULL);
if (parent_) {
parent_->SetEnabled(false);
@ -140,15 +142,17 @@ class FileChooserDialog {
void RunSaveAsynchronous(
electron::util::Promise<gin_helper::Dictionary> promise) {
save_promise_.reset(new electron::util::Promise<gin_helper::Dictionary>(
std::move(promise)));
save_promise_ =
std::make_unique<electron::util::Promise<gin_helper::Dictionary>>(
std::move(promise));
RunAsynchronous();
}
void RunOpenAsynchronous(
electron::util::Promise<gin_helper::Dictionary> promise) {
open_promise_.reset(new electron::util::Promise<gin_helper::Dictionary>(
std::move(promise)));
open_promise_ =
std::make_unique<electron::util::Promise<gin_helper::Dictionary>>(
std::move(promise));
RunAsynchronous();
}
@ -162,7 +166,7 @@ class FileChooserDialog {
std::vector<base::FilePath> GetFileNames() const {
std::vector<base::FilePath> paths;
auto* filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog_));
for (auto* iter = filenames; iter != NULL; iter = iter->next) {
for (auto* iter = filenames; iter != nullptr; iter = iter->next) {
auto* filename = static_cast<char*>(iter->data);
paths.emplace_back(filename);
g_free(filename);