Fix various Wcast-qual

g_atomic_int_get() requires a non-const pointer, however
many APIs are declared virtual const, so const_cast<> is
preferred over an API change.
This commit is contained in:
Robin Gareus 2022-01-09 23:49:08 +01:00
parent 2139b0391c
commit 30539716ca
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
6 changed files with 9 additions and 9 deletions

View File

@ -118,7 +118,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
bool is_realtime() const;
// for the user which hold state_lock to check if reset operation is pending
bool is_reset_requested() const { return g_atomic_int_get (&_hw_reset_request_count); }
bool is_reset_requested() const { return g_atomic_int_get (const_cast<GATOMIC_QUAL gint*> (&_hw_reset_request_count)); }
int set_device_name (const std::string&);
int set_sample_rate (float);

View File

@ -109,7 +109,7 @@ public:
void start_touch (timepos_t const & when);
void stop_touch (timepos_t const & when);
bool touching () const { return g_atomic_int_get (&_touching) != 0; }
bool touching () const { return g_atomic_int_get (const_cast<GATOMIC_QUAL gint*>(&_touching)) != 0; }
bool writing () const { return _state == Write; }
bool touch_enabled () const { return _state & (Touch | Latch); }

View File

@ -73,17 +73,17 @@ public:
/** Atomically get both the channel mode and mask. */
void get_mode_and_mask(ChannelMode* mode, uint16_t* mask) const {
const uint32_t mm = g_atomic_int_get (&_mode_mask);
const uint32_t mm = g_atomic_int_get (const_cast<GATOMIC_QUAL guint*> (&_mode_mask));
*mode = static_cast<ChannelMode>((mm & 0xFFFF0000) >> 16);
*mask = (mm & 0x0000FFFF);
}
ChannelMode get_channel_mode() const {
return static_cast<ChannelMode>((g_atomic_int_get (&_mode_mask) & 0xFFFF0000) >> 16);
return static_cast<ChannelMode>((g_atomic_int_get (const_cast<GATOMIC_QUAL guint*> (&_mode_mask)) & 0xFFFF0000) >> 16);
}
uint16_t get_channel_mask() const {
return g_atomic_int_get (&_mode_mask) & 0x0000FFFF;
return g_atomic_int_get (const_cast<GATOMIC_QUAL guint*> (&_mode_mask)) & 0x0000FFFF;
}
PBD::Signal0<void> ChannelMaskChanged;

View File

@ -390,7 +390,7 @@ public:
}
RecordState record_status() const {
return (RecordState) g_atomic_int_get (&_record_status);
return (RecordState) g_atomic_int_get (const_cast<GATOMIC_QUAL gint*> (&_record_status));
}
bool actively_recording () const {
@ -1613,7 +1613,7 @@ private:
static const PostTransportWork ProcessCannotProceedMask = PostTransportWork (PostTransportAudition);
GATOMIC_QUAL gint _post_transport_work; /* accessed only atomic ops */
PostTransportWork post_transport_work() const { return (PostTransportWork) g_atomic_int_get (&_post_transport_work); }
PostTransportWork post_transport_work() const { return (PostTransportWork) g_atomic_int_get (const_cast<GATOMIC_QUAL gint*> (&_post_transport_work)); }
void set_post_transport_work (PostTransportWork ptw) { g_atomic_int_set (&_post_transport_work, (gint) ptw); }
void add_post_transport_work (PostTransportWork ptw);

View File

@ -134,7 +134,7 @@ public:
virtual void inc_use_count ();
virtual void dec_use_count ();
int use_count() const { return g_atomic_int_get (&_use_count); }
int use_count() const { return g_atomic_int_get (const_cast<GATOMIC_QUAL gint*> (&_use_count)); }
bool used() const { return use_count() > 0; }
uint32_t level() const { return _level; }

View File

@ -105,7 +105,7 @@ class LIBPBD_API Stateful {
virtual void suspend_property_changes ();
virtual void resume_property_changes ();
bool property_changes_suspended() const { return g_atomic_int_get (&_stateful_frozen) > 0; }
bool property_changes_suspended() const { return g_atomic_int_get (const_cast<GATOMIC_QUAL gint*> (&_stateful_frozen)) > 0; }
protected: