From f13e28a9c5e411b817ce2b1346db8e600f547adc Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Nov 2021 11:53:01 +0400 Subject: [PATCH] Use in-class initializers for bitfields. --- Telegram/SourceFiles/boxes/peer_list_box.cpp | 14 ++------------ Telegram/SourceFiles/boxes/peer_list_box.h | 10 +++++----- .../calls/group/calls_group_members_row.cpp | 7 +------ .../calls/group/calls_group_members_row.h | 10 +++++----- Telegram/SourceFiles/data/data_group_call.h | 16 ++++++++-------- 5 files changed, 21 insertions(+), 36 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index 9ec96f9366..bdf951ee47 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -433,21 +433,11 @@ PeerListRow::PeerListRow(not_null peer) PeerListRow::PeerListRow(not_null peer, PeerListRowId id) : _id(id) -, _peer(peer) -, _hidden(false) -, _initialized(false) -, _isSearchResult(false) -, _isSavedMessagesChat(false) -, _isRepliesMessagesChat(false) { +, _peer(peer) { } PeerListRow::PeerListRow(PeerListRowId id) -: _id(id) -, _hidden(false) -, _initialized(false) -, _isSearchResult(false) -, _isSavedMessagesChat(false) -, _isRepliesMessagesChat(false) { +: _id(id) { } PeerListRow::~PeerListRow() = default; diff --git a/Telegram/SourceFiles/boxes/peer_list_box.h b/Telegram/SourceFiles/boxes/peer_list_box.h index 950feb1cae..9591dd3aed 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.h +++ b/Telegram/SourceFiles/boxes/peer_list_box.h @@ -263,11 +263,11 @@ private: base::flat_set _nameFirstLetters; int _absoluteIndex = -1; State _disabledState = State::Active; - bool _hidden : 1; - bool _initialized : 1; - bool _isSearchResult : 1; - bool _isSavedMessagesChat : 1; - bool _isRepliesMessagesChat : 1; + bool _hidden : 1 = false; + bool _initialized : 1 = false; + bool _isSearchResult : 1 = false; + bool _isSavedMessagesChat : 1 = false; + bool _isRepliesMessagesChat : 1 = false; }; diff --git a/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp b/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp index ec673d57f4..aaa7a9cea6 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp @@ -126,12 +126,7 @@ MembersRow::MembersRow( not_null delegate, not_null participantPeer) : PeerListRow(participantPeer) -, _delegate(delegate) -, _sounding(false) -, _speaking(false) -, _raisedHandStatus(false) -, _skipLevelUpdate(false) -, _mutedByMe(false) { +, _delegate(delegate) { refreshStatus(); _aboutText = participantPeer->about(); } diff --git a/Telegram/SourceFiles/calls/group/calls_group_members_row.h b/Telegram/SourceFiles/calls/group/calls_group_members_row.h index bbabbbe8c3..85f57664d0 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members_row.h +++ b/Telegram/SourceFiles/calls/group/calls_group_members_row.h @@ -210,11 +210,11 @@ private: crl::time _speakingLastTime = 0; uint64 _raisedHandRating = 0; int _volume = Group::kDefaultVolume; - bool _sounding : 1; - bool _speaking : 1; - bool _raisedHandStatus : 1; - bool _skipLevelUpdate : 1; - bool _mutedByMe : 1; + bool _sounding : 1 = false; + bool _speaking : 1 = false; + bool _raisedHandStatus : 1 = false; + bool _skipLevelUpdate : 1 = false; + bool _mutedByMe : 1 = false; }; diff --git a/Telegram/SourceFiles/data/data_group_call.h b/Telegram/SourceFiles/data/data_group_call.h index 9979d7b1d8..b1394f7a09 100644 --- a/Telegram/SourceFiles/data/data_group_call.h +++ b/Telegram/SourceFiles/data/data_group_call.h @@ -32,14 +32,14 @@ struct GroupCallParticipant { uint64 raisedHandRating = 0; uint32 ssrc = 0; int volume = 0; - bool sounding : 1; - bool speaking : 1; - bool additionalSounding : 1; - bool additionalSpeaking : 1; - bool muted : 1; - bool mutedByMe : 1; - bool canSelfUnmute : 1; - bool onlyMinLoaded : 1; + bool sounding : 1 = false; + bool speaking : 1 = false; + bool additionalSounding : 1 = false; + bool additionalSpeaking : 1 = false; + bool muted : 1 = false; + bool mutedByMe : 1 = false; + bool canSelfUnmute : 1 = false; + bool onlyMinLoaded : 1 = false; bool videoJoined = false; bool applyVolumeFromMin = true;