hal: fix compiler warnings which are now treated as errors
With CLANG enabled and -Wall & -Werror being set in
LOCAL_CFLAGS, all warnings are treated as errors.
This commit fixes all the warnings most of which are
about unused variables and functions.
Change-Id: I32c6593fa0ad6a4fdca5dc8e6c76982a146a8bc6
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
old mode 100755
new mode 100644
index d7a3169..4840bf1
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -249,8 +249,6 @@
static pthread_mutex_t adev_init_lock;
static unsigned int audio_device_ref_count;
-static int set_voice_volume_l(struct audio_device *adev, float volume);
-
__attribute__ ((visibility ("default")))
bool audio_hw_send_gain_dep_calibration(int level) {
bool ret_val = false;
@@ -938,7 +936,6 @@
struct audio_usecase *voip_usecase = NULL;
struct audio_usecase *hfp_usecase = NULL;
audio_usecase_t hfp_ucid;
- struct listnode *node;
int status = 0;
ALOGD("%s for use case (%s)", __func__, use_case_table[uc_id]);
@@ -1130,7 +1127,7 @@
static int stop_input_stream(struct stream_in *in)
{
- int i, ret = 0;
+ int ret = 0;
struct audio_usecase *uc_info;
struct audio_device *adev = in->dev;
@@ -1617,7 +1614,7 @@
static int stop_output_stream(struct stream_out *out)
{
- int i, ret = 0;
+ int ret = 0;
struct audio_usecase *uc_info;
struct audio_device *adev = out->dev;
@@ -2048,12 +2045,9 @@
{
struct stream_out *out = (struct stream_out *)stream;
struct audio_device *adev = out->dev;
- struct audio_usecase *usecase;
- struct listnode *node;
struct str_parms *parms;
char value[32];
int ret = 0, val = 0, err;
- bool select_new_device = false;
ALOGD("%s: enter: usecase(%d: %s) kvpairs: %s",
__func__, out->usecase, use_case_table[out->usecase], kvpairs);
@@ -2372,7 +2366,7 @@
ret = compress_write(out->compr, buffer, bytes);
if (ret < 0)
ret = -errno;
- ALOGVV("%s: writing buffer (%d bytes) to compress device returned %d", __func__, bytes, ret);
+ ALOGVV("%s: writing buffer (%zu bytes) to compress device returned %zd", __func__, bytes, ret);
if (ret >= 0 && ret < (ssize_t)bytes) {
ALOGD("No space available in compress driver, post msg to cb thread");
send_offload_cmd_l(out, OFFLOAD_CMD_WAIT_FOR_BUFFER);
@@ -2400,7 +2394,7 @@
if (out->muted)
memset((void *)buffer, 0, bytes);
- ALOGVV("%s: writing buffer (%d bytes) to pcm device", __func__, bytes);
+ ALOGVV("%s: writing buffer (%zu bytes) to pcm device", __func__, bytes);
if (adev->adm_request_focus)
adev->adm_request_focus(adev->adm_data, out->handle);
@@ -2761,7 +2755,6 @@
struct stream_in *in = (struct stream_in *)stream;
struct audio_device *adev = in->dev;
struct str_parms *parms;
- char *str;
char value[32];
int ret = 0, val = 0, err;
@@ -2805,7 +2798,6 @@
}
}
-done:
pthread_mutex_unlock(&adev->lock);
pthread_mutex_unlock(&in->lock);
@@ -2821,7 +2813,6 @@
struct stream_in *in = (struct stream_in *)stream;
struct str_parms *query = str_parms_create_str(keys);
char *str;
- char value[256];
struct str_parms *reply = str_parms_create();
if (!query || !reply) {
@@ -2858,7 +2849,7 @@
{
struct stream_in *in = (struct stream_in *)stream;
struct audio_device *adev = in->dev;
- int i, ret = -1;
+ int ret = -1;
int snd_scard_state = get_snd_card_state(adev);
lock_input_stream(in);
@@ -3005,7 +2996,7 @@
{
struct audio_device *adev = (struct audio_device *)dev;
struct stream_out *out;
- int i, ret = 0;
+ int ret = 0;
audio_format_t format;
*stream_out = NULL;
@@ -3226,7 +3217,7 @@
//Decide if we need to use gapless mode by default
check_and_set_gapless_mode(adev);
} else if (out->flags & AUDIO_OUTPUT_FLAG_INCALL_MUSIC) {
- ret = voice_check_and_set_incall_music_usecase(adev, out);
+ ret = voice_extn_check_and_set_incall_music_usecase(adev, out);
if (ret != 0) {
ALOGE("%s: Incall music delivery usecase cannot be set error:%d",
__func__, ret);
@@ -3416,7 +3407,6 @@
{
struct audio_device *adev = (struct audio_device *)dev;
struct str_parms *parms;
- char *str;
char value[32];
int val;
int ret;
@@ -3431,8 +3421,6 @@
if (ret >= 0) {
char *snd_card_status = value+2;
if (strstr(snd_card_status, "OFFLINE")) {
- struct listnode *node;
- struct audio_usecase *usecase;
ALOGD("Received sound card OFFLINE status");
set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
//close compress sessions on OFFLINE status
@@ -3899,8 +3887,6 @@
static int adev_open(const hw_module_t *module, const char *name,
hw_device_t **device)
{
- int i, ret;
-
ALOGD("%s: enter", __func__);
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0) return -EINVAL;