diff options
author | Chih-Hung Hsieh <chh@google.com> | 2017-10-18 16:28:14 -0700 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2017-10-20 15:46:36 -0700 |
commit | 373d3c7257fa815d0b9ee8f16874470a6002042e (patch) | |
tree | 2488faeb9a5a2dfd9f76054bd4ba001b4806ffb3 /sound | |
parent | d7bf23ae7b93ec93b8b7c2ce98eaa2ea94f387aa (diff) | |
download | extras-373d3c7257fa815d0b9ee8f16874470a6002042e.tar.gz |
Use -Werror in system/extras
* Remove unused variables.
* Fix redefined macro warnings.
* Fix sign-compare warnings.
* Fix 'return false' in main().
* Keep existing warnings to fix later.
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: Ib92ef5297693595fb84ed4f8e61665bda4cee312
Diffstat (limited to 'sound')
-rw-r--r-- | sound/Android.mk | 2 | ||||
-rw-r--r-- | sound/playwav.c | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sound/Android.mk b/sound/Android.mk index a08c4371..860c4958 100644 --- a/sound/Android.mk +++ b/sound/Android.mk @@ -3,6 +3,6 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := sound LOCAL_SRC_FILES := playwav.c -LOCAL_CFLAGS := -Wno-unused-parameter +LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter include $(BUILD_EXECUTABLE) diff --git a/sound/playwav.c b/sound/playwav.c index 19a755e8..604ad959 100644 --- a/sound/playwav.c +++ b/sound/playwav.c @@ -40,7 +40,9 @@ int pcm_play(unsigned rate, unsigned channels, void *cookie) { struct msm_audio_config config; +#if 0 struct msm_audio_stats stats; +#endif unsigned sz, n; char buf[8192]; int afd; @@ -72,7 +74,7 @@ int pcm_play(unsigned rate, unsigned channels, for (n = 0; n < config.buffer_count; n++) { if (fill(buf, sz, cookie)) break; - if (write(afd, buf, sz) != sz) + if (write(afd, buf, sz) != (ssize_t) sz) break; } @@ -86,11 +88,10 @@ int pcm_play(unsigned rate, unsigned channels, #endif if (fill(buf, sz, cookie)) break; - if (write(afd, buf, sz) != sz) + if (write(afd, buf, sz) != (ssize_t) sz) break; } -done: close(afd); return 0; } @@ -142,7 +143,7 @@ void play_file(unsigned rate, unsigned channels, fprintf(stderr,"could not allocate %d bytes\n", count); return; } - if (read(fd, next, count) != count) { + if (read(fd, next, count) != (ssize_t) count) { fprintf(stderr,"could not read %d bytes\n", count); return; } @@ -153,7 +154,6 @@ void play_file(unsigned rate, unsigned channels, int wav_play(const char *fn) { struct wav_header hdr; - unsigned rate, channels; int fd; fd = open(fn, O_RDONLY); if (fd < 0) { @@ -195,7 +195,7 @@ int wav_rec(const char *fn, unsigned channels, unsigned rate) struct wav_header hdr; unsigned char buf[8192]; struct msm_audio_config cfg; - unsigned sz, n; + unsigned sz; int fd, afd; unsigned total = 0; unsigned char tmp; @@ -265,11 +265,11 @@ int wav_rec(const char *fn, unsigned channels, unsigned rate) while (read(0, &tmp, 1) == 1) { if ((tmp == 13) || (tmp == 10)) goto done; } - if (read(afd, buf, sz) != sz) { + if (read(afd, buf, sz) != (ssize_t) sz) { perror("cannot read buffer"); goto fail; } - if (write(fd, buf, sz) != sz) { + if (write(fd, buf, sz) != (ssize_t) sz) { perror("cannot write buffer"); goto fail; } |