diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-10 22:07:09 +0000 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-10 22:07:09 +0000 |
commit | 6bbe77a79ad7d82e11ab0e76fe14261573a10f71 (patch) | |
tree | 8d57b4e7c253784635d171cfc0e351739cb035b1 | |
parent | 350211381a270fc6f5e02d3a75cbf6bf99152ec8 (diff) |
pcm: Constify write buffers
Mark the write buffers as const - they won't be modified and this is
friendlier to applications.
-rw-r--r-- | include/tinyalsa/asoundlib.h | 4 | ||||
-rw-r--r-- | pcm.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index a6d5436..cac2786 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -133,13 +133,13 @@ int pcm_get_htimestamp(struct pcm *pcm, unsigned int *avail, * Will start playback on the first write or on a write that * occurs after a fifo underrun. */ -int pcm_write(struct pcm *pcm, void *data, unsigned int count); +int pcm_write(struct pcm *pcm, const void *data, unsigned int count); int pcm_read(struct pcm *pcm, void *data, unsigned int count); /* * mmap() support. */ -int pcm_mmap_write(struct pcm *pcm, void *data, unsigned int count); +int pcm_mmap_write(struct pcm *pcm, const void *data, unsigned int count); int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset, unsigned int *frames); int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames); @@ -295,7 +295,7 @@ static int pcm_areas_copy(struct pcm *pcm, unsigned int pcm_offset, return 0; } -static int pcm_mmap_write_areas(struct pcm *pcm, char *src, +static int pcm_mmap_write_areas(struct pcm *pcm, const char *src, unsigned int offset, unsigned int size) { void *pcm_areas; @@ -355,14 +355,14 @@ int pcm_get_htimestamp(struct pcm *pcm, unsigned int *avail, return 0; } -int pcm_write(struct pcm *pcm, void *data, unsigned int count) +int pcm_write(struct pcm *pcm, const void *data, unsigned int count) { struct snd_xferi x; if (pcm->flags & PCM_IN) return -EINVAL; - x.buf = data; + x.buf = (void*)data; x.frames = count / (pcm->config.channels * pcm_format_to_bits(pcm->config.format) / 8); @@ -748,7 +748,7 @@ int pcm_wait(struct pcm *pcm, int timeout) return 1; } -int pcm_mmap_write(struct pcm *pcm, void *buffer, unsigned int bytes) +int pcm_mmap_write(struct pcm *pcm, const void *buffer, unsigned int bytes) { int err = 0, frames, avail; unsigned int offset = 0, count; |