From a0446a3c8ac686d970a693ebf4bac386b93b0531 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Sun, 21 Jan 2024 14:18:09 -0500 Subject: [PATCH] Fix clang-tidy warnings (see #3632) --- libcef/browser/browser_info.h | 2 ++ libcef/browser/chrome/chrome_context_menu_handler.cc | 2 +- libcef/browser/net_service/cookie_helper.cc | 3 ++- libcef/browser/net_service/proxy_url_loader_factory.cc | 2 ++ tests/ceftests/frame_handler_unittest.cc | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libcef/browser/browser_info.h b/libcef/browser/browser_info.h index d53d77ab7..f94c41e3d 100644 --- a/libcef/browser/browser_info.h +++ b/libcef/browser/browser_info.h @@ -130,7 +130,9 @@ class CefBrowserInfo : public base::RefCountedThreadSafe { friend class CefBrowserInfo; friend class base::RefCounted; + // All usage is via friend declaration. NOLINTNEXTLINE NavigationLock(); + // All usage is via friend declaration. NOLINTNEXTLINE ~NavigationLock(); base::OnceClosure pending_action_; diff --git a/libcef/browser/chrome/chrome_context_menu_handler.cc b/libcef/browser/chrome/chrome_context_menu_handler.cc index 1a0a10f20..c4d7b604c 100644 --- a/libcef/browser/chrome/chrome_context_menu_handler.cc +++ b/libcef/browser/chrome/chrome_context_menu_handler.cc @@ -33,7 +33,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver, const_cast(&context_menu_->params())); model_ = new CefSimpleMenuModelImpl( const_cast(&context_menu_->menu_model()), - context_menu_, this, /*is_owned=*/false, /*is_popup=*/false); + context_menu_, this, /*is_owned=*/false, /*is_submenu=*/false); handler_->OnBeforeContextMenu(browser_, GetFrame(), params_, model_); } diff --git a/libcef/browser/net_service/cookie_helper.cc b/libcef/browser/net_service/cookie_helper.cc index c944b6c2a..dd6cd2835 100644 --- a/libcef/browser/net_service/cookie_helper.cc +++ b/libcef/browser/net_service/cookie_helper.cc @@ -298,7 +298,8 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter, net::CookieInclusionStatus returned_status; std::unique_ptr cookie = net::CanonicalCookie::Create( request.url, cookie_string, base::Time::Now(), - absl::make_optional(response_date), /*partition_key=*/absl::nullopt, + absl::make_optional(response_date), + /*cookie_partition_key=*/absl::nullopt, /*block_truncated=*/true, &returned_status); if (!returned_status.IsInclude()) { continue; diff --git a/libcef/browser/net_service/proxy_url_loader_factory.cc b/libcef/browser/net_service/proxy_url_loader_factory.cc index 6c1ef1fc3..a787cca0b 100644 --- a/libcef/browser/net_service/proxy_url_loader_factory.cc +++ b/libcef/browser/net_service/proxy_url_loader_factory.cc @@ -824,6 +824,7 @@ void InterceptedRequest::InterceptResponseReceived( current_response_->encoded_data_length = headers->raw_headers().length(); current_response_->content_length = 0; + // Avoid incorrect replacement of 0 with nullptr. NOLINTNEXTLINE current_response_->encoded_body_length = 0; std::string origin; @@ -981,6 +982,7 @@ net::RedirectInfo InterceptedRequest::MakeRedirectResponseAndInfo( // Clear the Content-Length values. current_response_->content_length = 0; + // Avoid incorrect replacement of 0 with nullptr. NOLINTNEXTLINE current_response_->encoded_body_length = 0; current_response_->headers->RemoveHeader( net::HttpRequestHeaders::kContentLength); diff --git a/tests/ceftests/frame_handler_unittest.cc b/tests/ceftests/frame_handler_unittest.cc index 41270d1d5..f3c53d36c 100644 --- a/tests/ceftests/frame_handler_unittest.cc +++ b/tests/ceftests/frame_handler_unittest.cc @@ -1694,7 +1694,7 @@ class ParentOrderMainTestHandler : public OrderMainTestHandler { }; void RunOrderMainPopupTest(bool cross_origin) { - TestHandler::CompletionState completion_state(/*count=*/2); + TestHandler::CompletionState completion_state(/*total=*/2); TestHandler::Collection collection(&completion_state); CefRefPtr popup_handler =