summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2024-02-09 14:11:35 -0800
committerAndy Hung <hunga@google.com>2024-03-12 14:49:14 -0700
commitaead8b971fcfe6bdb30459501f9e605829f73b37 (patch)
tree5b18121a0c0fb455155a65d2fb15c551b6e61b29
parent3d995dfe04ab61e25e5f6c5455ed870717872cea (diff)
downloadmedia-aead8b971fcfe6bdb30459501f9e605829f73b37.tar.gz
audio mutex: Minor updates
Fix clang warnings. Zero initialize instead of default initialize. Test: compiles Bug: 324511705 Merged-In: I8c616385ceb24f02c401c719082f66e7d11061ef Change-Id: I8c616385ceb24f02c401c719082f66e7d11061ef
-rw-r--r--audio_utils/include/audio_utils/mutex.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/audio_utils/include/audio_utils/mutex.h b/audio_utils/include/audio_utils/mutex.h
index ea846874..bd1183d9 100644
--- a/audio_utils/include/audio_utils/mutex.h
+++ b/audio_utils/include/audio_utils/mutex.h
@@ -397,7 +397,7 @@ public:
template <typename T>
class relaxed_atomic : private std::atomic<T> {
public:
- constexpr relaxed_atomic(T desired) : std::atomic<T>(desired) {}
+ constexpr relaxed_atomic(T desired = {}) : std::atomic<T>(desired) {}
operator T() const { return std::atomic<T>::load(std::memory_order_relaxed); }
T operator=(T desired) {
std::atomic<T>::store(desired, std::memory_order_relaxed); return desired;
@@ -446,8 +446,7 @@ template <typename T>
class unordered_atomic {
static_assert(std::atomic<T>::is_always_lock_free);
public:
- unordered_atomic() = default;
- constexpr unordered_atomic(T desired) : t_(desired) {}
+ constexpr unordered_atomic(T desired = {}) : t_(desired) {}
operator T() const { return t_; }
T& operator=(T desired) { return t_ = desired; }
@@ -1236,8 +1235,8 @@ public:
, stat_{get_mutex_stat_array()[static_cast<size_t>(order)]}
{
LOG_ALWAYS_FATAL_IF(static_cast<size_t>(order) >= Attributes::order_size_,
- "mutex order %u is equal to or greater than order limit:%zu",
- order, Attributes::order_size_);
+ "mutex order %zu is equal to or greater than order limit:%zu",
+ static_cast<size_t>(order), Attributes::order_size_);
if (!priority_inheritance) return;
@@ -1260,7 +1259,8 @@ public:
if (ret != 0) {
ALOGW("%s, pthread_mutex_init returned %d", __func__, ret);
}
- ALOGV("%s: audio_mutex initialized: ret:%d order:%u", __func__, ret, order_);
+ ALOGV("%s: audio_mutex initialized: ret:%d order:%zu",
+ __func__, ret, static_cast<size_t>(order_));
}
~mutex_impl() {