audio: Fix clang warnings
Generally these warnings come from -Wformat
Test: compiles
Bug: 324511705
Merged-In: I6129b0793e2aa85e9a2b407c473c766f61122d1b
Change-Id: I6129b0793e2aa85e9a2b407c473c766f61122d1b
diff --git a/include/media/Interpolator.h b/include/media/Interpolator.h
index 0ee8779..e26290f 100644
--- a/include/media/Interpolator.h
+++ b/include/media/Interpolator.h
@@ -204,7 +204,7 @@
mInterpolatorType = interpolatorType;
return NO_ERROR;
default:
- ALOGE("invalid interpolatorType: %d", interpolatorType);
+ ALOGE("invalid interpolatorType: %d", static_cast<int>(interpolatorType));
return BAD_VALUE;
}
}
diff --git a/media/audioaidlconversion/AidlConversionCppNdk.cpp b/media/audioaidlconversion/AidlConversionCppNdk.cpp
index bcb31f3..9eaddce 100644
--- a/media/audioaidlconversion/AidlConversionCppNdk.cpp
+++ b/media/audioaidlconversion/AidlConversionCppNdk.cpp
@@ -904,7 +904,7 @@
case Tag::voiceMask:
return convert(aidl, mVoice, __func__, "voice");
}
- ALOGE("%s: unexpected tag value %d", __func__, aidl.getTag());
+ ALOGE("%s: unexpected tag value %d", __func__, static_cast<int>(aidl.getTag()));
return unexpected(BAD_VALUE);
}
diff --git a/media/libaudiofoundation/AudioPort.cpp b/media/libaudiofoundation/AudioPort.cpp
index ae0457f..6dbf284 100644
--- a/media/libaudiofoundation/AudioPort.cpp
+++ b/media/libaudiofoundation/AudioPort.cpp
@@ -192,7 +192,8 @@
dst->append(
base::StringPrintf("%*s extra audio descriptor %zu:\n", eadSpaces, "", i));
dst->append(base::StringPrintf(
- "%*s- standard: %u\n", descSpaces, "", mExtraAudioDescriptors[i].standard));
+ "%*s- standard: %u\n", descSpaces, "",
+ static_cast<unsigned>(mExtraAudioDescriptors[i].standard)));
dst->append(base::StringPrintf("%*s- descriptor:", descSpaces, ""));
for (auto v : mExtraAudioDescriptors[i].audioDescriptor) {
dst->append(base::StringPrintf(" %02x", v));
diff --git a/media/libeffects/hapticgenerator/EffectHapticGenerator.cpp b/media/libeffects/hapticgenerator/EffectHapticGenerator.cpp
index d8cf20e..bd43994 100644
--- a/media/libeffects/hapticgenerator/EffectHapticGenerator.cpp
+++ b/media/libeffects/hapticgenerator/EffectHapticGenerator.cpp
@@ -317,7 +317,7 @@
}
int id = *(int *) value;
os::HapticScale hapticIntensity = static_cast<os::HapticScale>(*((int *) value + 1));
- ALOGD("Setting haptic intensity as %d", hapticIntensity);
+ ALOGD("Setting haptic intensity as %d", static_cast<int>(hapticIntensity));
if (hapticIntensity == os::HapticScale::MUTE) {
context->param.id2Intensity.erase(id);
} else {
diff --git a/media/libnbaio/SourceAudioBufferProvider.cpp b/media/libnbaio/SourceAudioBufferProvider.cpp
index d58619f..157ebd7 100644
--- a/media/libnbaio/SourceAudioBufferProvider.cpp
+++ b/media/libnbaio/SourceAudioBufferProvider.cpp
@@ -32,7 +32,7 @@
// negotiate with source
NBAIO_Format counterOffers[1];
size_t numCounterOffers = 1;
- ssize_t index = source->negotiate(NULL, 0, counterOffers, numCounterOffers);
+ [[maybe_unused]] ssize_t index = source->negotiate(NULL, 0, counterOffers, numCounterOffers);
ALOG_ASSERT(index == (ssize_t) NEGOTIATE && numCounterOffers > 0);
numCounterOffers = 0;
index = source->negotiate(counterOffers, 1, NULL, numCounterOffers);
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 403fb9e..7d63afb 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -4647,7 +4647,7 @@
case TransactionCode::GET_AUDIO_POLICY_CONFIG:
case TransactionCode::GET_AUDIO_MIX_PORT:
ALOGW("%s: transaction %d received from PID %d",
- __func__, code, IPCThreadState::self()->getCallingPid());
+ __func__, static_cast<int>(code), IPCThreadState::self()->getCallingPid());
// return status only for non void methods
switch (code) {
case TransactionCode::SET_RECORD_SILENCED:
@@ -4680,7 +4680,8 @@
case TransactionCode::SUPPORTS_BLUETOOTH_VARIABLE_LATENCY: {
if (!isServiceUid(IPCThreadState::self()->getCallingUid())) {
ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
- __func__, code, IPCThreadState::self()->getCallingPid(),
+ __func__, static_cast<int>(code),
+ IPCThreadState::self()->getCallingPid(),
IPCThreadState::self()->getCallingUid());
// return status only for non-void methods
switch (code) {
diff --git a/services/audioflinger/sounddose/SoundDoseManager.cpp b/services/audioflinger/sounddose/SoundDoseManager.cpp
index 39c80d8..44f75d8 100644
--- a/services/audioflinger/sounddose/SoundDoseManager.cpp
+++ b/services/audioflinger/sounddose/SoundDoseManager.cpp
@@ -236,7 +236,7 @@
auto id = soundDoseManager->getIdForAudioDevice(in_audioDevice);
if (id == AUDIO_PORT_HANDLE_NONE) {
ALOGI("%s: no mapped id for audio device with type %d and address %s",
- __func__, in_audioDevice.type.type,
+ __func__, static_cast<int>(in_audioDevice.type.type),
in_audioDevice.address.toString().c_str());
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
@@ -265,7 +265,7 @@
auto id = soundDoseManager->getIdForAudioDevice(in_audioDevice);
if (id == AUDIO_PORT_HANDLE_NONE) {
ALOGI("%s: no mapped id for audio device with type %d and address %s",
- __func__, in_audioDevice.type.type,
+ __func__, static_cast<int>(in_audioDevice.type.type),
in_audioDevice.address.toString().c_str());
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
index dd222de..c7d2e6b 100644
--- a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
@@ -156,9 +156,9 @@
for (const auto sampleRate : profile->getSampleRates()) {
for (const auto channelMask : profile->getChannels()) {
const audio_config_base_t config = {
- .format = profile->getFormat(),
.sample_rate = sampleRate,
- .channel_mask = channelMask
+ .channel_mask = channelMask,
+ .format = profile->getFormat(),
};
for (const auto mixerBehavior : mMixerBehaviors) {
mixerAttributes->push_back({
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 0057c9b..3dfd950 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -122,7 +122,8 @@
device->toAudioPort(&devicePort);
if (status_t status = mpClientInterface->setDeviceConnectedState(&devicePort, state);
status != OK) {
- ALOGE("Error %d while setting connected state for device %s", state,
+ ALOGE("Error %d while setting connected state for device %s",
+ static_cast<int>(state),
device->getDeviceTypeAddr().toString(false).c_str());
}
}
diff --git a/services/audiopolicy/service/Spatializer.cpp b/services/audiopolicy/service/Spatializer.cpp
index 7859c2c..72582d3 100644
--- a/services/audiopolicy/service/Spatializer.cpp
+++ b/services/audiopolicy/service/Spatializer.cpp
@@ -821,7 +821,7 @@
spatializerMode = HeadTracking::Mode::RELATIVE_SCREEN;
break;
default:
- LOG_ALWAYS_FATAL("Unknown mode: %d", mode);
+ LOG_ALWAYS_FATAL("Unknown mode: %d", static_cast<int>(mode));
}
}
mActualHeadTrackingMode = spatializerMode;
diff --git a/services/oboeservice/AAudioServiceStreamBase.cpp b/services/oboeservice/AAudioServiceStreamBase.cpp
index 65854c8..63cf432 100644
--- a/services/oboeservice/AAudioServiceStreamBase.cpp
+++ b/services/oboeservice/AAudioServiceStreamBase.cpp
@@ -643,7 +643,7 @@
int32_t count = mUpMessageQueue->getFifoBuffer()->write(command, 1);
if (count != 1) {
ALOGW("%s(): Queue full. Did client stop? Suspending stream. what = %u, %s",
- __func__, command->what, getTypeText());
+ __func__, static_cast<unsigned>(command->what), getTypeText());
setSuspended(true);
return AAUDIO_ERROR_WOULD_BLOCK;
} else {