diff options
author | AdrianDC <radian.dc@gmail.com> | 2015-12-31 19:45:45 +0100 |
---|---|---|
committer | AdrianDC <radian.dc@gmail.com> | 2015-12-31 19:50:46 +0100 |
commit | b932690a3731dcccf9c851bf6556c4dd18941702 (patch) | |
tree | 2ffdba0ee1ae7a1e32e6eb3062cae68beca09ab8 | |
parent | 3fb8900718008c19a0d5e69fb27e1a9d6a1ab7eb (diff) | |
download | hardware_qcom_audio-b932690a3731dcccf9c851bf6556c4dd18941702.tar.gz hardware_qcom_audio-b932690a3731dcccf9c851bf6556c4dd18941702.tar.bz2 hardware_qcom_audio-b932690a3731dcccf9c851bf6556c4dd18941702.zip |
libalsa-intf: Fix clang compiler errors
Change-Id: I1ac4675d1f036eca0695442a9e9866e3fb338e4f
Signed-off-by: AdrianDC <radian.dc@gmail.com>
-rw-r--r-- | legacy/libalsa-intf/alsa_audio.h | 2 | ||||
-rw-r--r-- | legacy/libalsa-intf/alsa_pcm.c | 8 | ||||
-rw-r--r-- | legacy/libalsa-intf/alsa_ucm.c | 6 | ||||
-rw-r--r-- | legacy/libalsa-intf/aplay.c | 3 |
4 files changed, 6 insertions, 13 deletions
diff --git a/legacy/libalsa-intf/alsa_audio.h b/legacy/libalsa-intf/alsa_audio.h index b4c033dd..bc99b210 100644 --- a/legacy/libalsa-intf/alsa_audio.h +++ b/legacy/libalsa-intf/alsa_audio.h @@ -129,7 +129,7 @@ struct mixer { int get_format(const char* name); const char *get_format_name(int format); const char *get_format_desc(int format); -struct pcm *pcm_open(unsigned flags, char *device); +struct pcm *pcm_open(unsigned flags, const char *device); int pcm_close(struct pcm *pcm); int pcm_ready(struct pcm *pcm); int mmap_buffer(struct pcm *pcm); diff --git a/legacy/libalsa-intf/alsa_pcm.c b/legacy/libalsa-intf/alsa_pcm.c index d6428718..2cb1b9a1 100644 --- a/legacy/libalsa-intf/alsa_pcm.c +++ b/legacy/libalsa-intf/alsa_pcm.c @@ -816,7 +816,7 @@ static struct pcm bad_pcm = { .fd = -1, }; -static int enable_timer(struct pcm *pcm) { +static struct pcm *enable_timer(struct pcm *pcm) { pcm->timer_fd = open("/dev/snd/timer", O_RDWR | O_NONBLOCK); if (pcm->timer_fd < 0) { @@ -865,7 +865,7 @@ static int enable_timer(struct pcm *pcm) { close(pcm->timer_fd); ALOGE("SNDRV_TIMER_IOCTL_START failed\n"); } - return 0; + return pcm; } static int disable_timer(struct pcm *pcm) { @@ -912,7 +912,7 @@ int pcm_close(struct pcm *pcm) return 0; } -struct pcm *pcm_open(unsigned flags, char *device) +struct pcm *pcm_open(unsigned flags, const char *device) { char dname[19]; struct pcm *pcm; @@ -936,7 +936,7 @@ struct pcm *pcm_open(unsigned flags, char *device) if ((strncmp(device, "hw:",3) != 0) || (strncmp(tmp, ",",1) != 0)){ ALOGE("Wrong device fromat\n"); free(pcm); - return -EINVAL; + return &bad_pcm; } if (flags & PCM_IN) { diff --git a/legacy/libalsa-intf/alsa_ucm.c b/legacy/libalsa-intf/alsa_ucm.c index 5583d53e..d7dd3181 100644 --- a/legacy/libalsa-intf/alsa_ucm.c +++ b/legacy/libalsa-intf/alsa_ucm.c @@ -293,11 +293,7 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, } if (!strncmp(identifier, "_verb", 5)) { - if (uc_mgr->card_ctxt_ptr->current_verb != NULL) { - *value = strdup(uc_mgr->card_ctxt_ptr->current_verb); - } else { - *value = NULL; - } + *value = strdup(uc_mgr->card_ctxt_ptr->current_verb); pthread_mutex_unlock(&uc_mgr->card_ctxt_ptr->card_lock); return 0; } diff --git a/legacy/libalsa-intf/aplay.c b/legacy/libalsa-intf/aplay.c index e82582ce..a6d72183 100644 --- a/legacy/libalsa-intf/aplay.c +++ b/legacy/libalsa-intf/aplay.c @@ -251,9 +251,6 @@ static int play_file(unsigned rate, unsigned channels, int fd, flags |= DEBUG_OFF; pcm = pcm_open(flags, device); - if (pcm < 0) - return pcm; - if (!pcm_ready(pcm)) { pcm_close(pcm); return -EBADFD; |