From c1fd46f8798aa8a167a6e1f8795e88595db61847 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Mon, 7 Feb 2022 09:54:08 +0000 Subject: [PATCH] Revert "Mark all bool conversion operators as explicit" This reverts commit 325789c4576b60147ee1ef225d438cbb740f65ff. Reason for revert: Breaks downstream clients. Original change's description: > Mark all bool conversion operators as explicit > > An explicit bool conversion operator will still be used implicitly > when an expression appears in "bool context", e.g., as the condition > in an if statement, or as argument to logical operators. The > `explicit` annotation prevents conversion in other contexts, e.g., > converting both a and b to bool in an expression like `a == b`. > > Bug: None > Change-Id: I79ef35b1ea831e6011ae472900375ae8a3e617ab > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250664 > Reviewed-by: Tomas Gunnarsson > Reviewed-by: Mirko Bonadei > Commit-Queue: Niels Moller > Cr-Commit-Position: refs/heads/main@{#35927} TBR=mbonadei@webrtc.org,nisse@webrtc.org,tommi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com Change-Id: I392cd0c7bd96c90e0db20831864418adb7d58bc3 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: None Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251080 Auto-Submit: Mirko Bonadei Owners-Override: Mirko Bonadei Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#35929} --- .../rtc_event_log/events/rtc_event_field_encoding_parser.h | 4 +--- modules/congestion_controller/goog_cc/probe_controller.cc | 2 +- .../desktop_capture/linux/wayland/shared_screencast_stream.cc | 2 +- rtc_base/experiments/field_trial_parser.h | 2 +- sdk/objc/unittests/scoped_cftyperef_tests.mm | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h b/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h index d3719e575e..6b0270b127 100644 --- a/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h +++ b/logging/rtc_event_log/events/rtc_event_field_encoding_parser.h @@ -36,9 +36,7 @@ class RtcEventLogParseStatus { } bool ok() const { return error_.empty(); } - ABSL_DEPRECATED("Use ok() instead") explicit operator bool() const { - return ok(); - } + ABSL_DEPRECATED("Use ok() instead") operator bool() const { return ok(); } std::string message() const { return error_; } diff --git a/modules/congestion_controller/goog_cc/probe_controller.cc b/modules/congestion_controller/goog_cc/probe_controller.cc index df753ed0c9..cb75456fde 100644 --- a/modules/congestion_controller/goog_cc/probe_controller.cc +++ b/modules/congestion_controller/goog_cc/probe_controller.cc @@ -225,7 +225,7 @@ std::vector ProbeController::OnMaxTotalAllocatedBitrate( probes.push_back(second_probe_rate.bps()); } return InitiateProbing(at_time_ms, probes, - config_.allocation_allow_further_probing.Get()); + config_.allocation_allow_further_probing); } max_total_allocated_bitrate_ = max_total_allocated_bitrate; return std::vector(); diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc index 1afb0ee491..8fae69ed9c 100644 --- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc +++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc @@ -149,7 +149,7 @@ class ScopedBuf { } } - explicit operator bool() { return map_ != MAP_FAILED; } + operator bool() { return map_ != MAP_FAILED; } void initialize(uint8_t* map, int map_size, int fd) { map_ = map; diff --git a/rtc_base/experiments/field_trial_parser.h b/rtc_base/experiments/field_trial_parser.h index bd11eea20a..c67ef542d3 100644 --- a/rtc_base/experiments/field_trial_parser.h +++ b/rtc_base/experiments/field_trial_parser.h @@ -220,7 +220,7 @@ class FieldTrialFlag : public FieldTrialParameterInterface { explicit FieldTrialFlag(std::string key); FieldTrialFlag(std::string key, bool default_value); bool Get() const; - explicit operator bool() const; + operator bool() const; protected: bool Parse(absl::optional str_value) override; diff --git a/sdk/objc/unittests/scoped_cftyperef_tests.mm b/sdk/objc/unittests/scoped_cftyperef_tests.mm index 26a6d0b3b9..2aa85182a6 100644 --- a/sdk/objc/unittests/scoped_cftyperef_tests.mm +++ b/sdk/objc/unittests/scoped_cftyperef_tests.mm @@ -16,7 +16,7 @@ namespace { struct TestType { TestType() : has_value(true) {} TestType(bool b) : has_value(b) {} - explicit operator bool() { return has_value; } + operator bool() { return has_value; } bool has_value; int retain_count = 0; };