Permalink
Browse files

Make write() method of device I/O functions const correct.

  • Loading branch information...
1 parent bf480c4 commit 9ab4109debc935f2fdeb4e9b6ed58a24c88177ce @erikd committed Jan 26, 2012
Showing with 12 additions and 12 deletions.
  1. +1 −1 src/driver.c
  2. +6 −6 src/driver.h
  3. +1 −1 src/driver_alsa.c
  4. +1 −1 src/driver_oss.c
  5. +2 −2 src/driver_pulseaudio.c
  6. +1 −1 src/driver_solaris.c
View
2 src/driver.c
@@ -761,7 +761,7 @@ device_read (sw_handle * handle, sw_audio_t * buf, size_t count)
}
ssize_t
-device_write (sw_handle * handle, sw_audio_t * buf, size_t count)
+device_write (sw_handle * handle, const sw_audio_t * buf, size_t count)
{
#ifdef DEBUG
printf ("device_write: %d from %d\n", count, offset);
View
12 src/driver.h
@@ -45,13 +45,13 @@ struct _sw_driver {
void (*setup) (sw_handle * handle, sw_format * format);
int (*wait) (sw_handle * handle);
ssize_t (*read) (sw_handle * handle, sw_audio_t * buf, size_t count);
- ssize_t (*write) (sw_handle * handle, sw_audio_t * buf, size_t count);
+ ssize_t (*write) (sw_handle * handle, const sw_audio_t * buf, size_t count);
sw_framecount_t (*offset) (sw_handle * handle);
void (*reset) (sw_handle * handle);
void (*flush) (sw_handle * handle);
void (*drain) (sw_handle * handle);
void (*close) (sw_handle * handle);
-
+
char * primary_device_key;
char * monitor_device_key;
char * log_frags_key;
@@ -76,20 +76,20 @@ ssize_t
device_read (sw_handle * handle, sw_audio_t * buf, size_t count);
ssize_t
-device_write (sw_handle * handle, sw_audio_t * buf, size_t count);
+device_write (sw_handle * handle, const sw_audio_t * buf, size_t count);
/* As far as I'm aware the method
* used to monitor latency in OSS and Solaris etc. is different to that which
* ALSA uses, and different again from JACK and PortAudio.
- *
+ *
* Basically, when the device is written to, the driver is also told what the
* offset into the file is for that bit of sound.
- *
+ *
* Then, when the GUI thread goes to draw the cursor, it asks the driver
* what the offset of the sound that's currently coming out of the speaker is
* and draws it there (which may be a little behind or ahead of where the
* user is scrubbing) -- hence the sound and the vision are kept in sync.
- *
+ *
* However, this is all currently disabled, and going to change, as its not
* properly monitoring the latency of multiple files being played
* simultaneously; plus it may have to change with respect to ALSA and JACK and
View
2 src/driver_alsa.c
@@ -322,7 +322,7 @@ alsa_device_read (sw_handle * handle, sw_audio_t * buf, size_t count)
}
static ssize_t
-alsa_device_write (sw_handle * handle, sw_audio_t * buf, size_t count)
+alsa_device_write (sw_handle * handle, const sw_audio_t * buf, size_t count)
{
snd_pcm_t * pcm_handle = (snd_pcm_t *)handle->custom_data;
snd_pcm_uframes_t uframes;
View
2 src/driver_oss.c
@@ -299,7 +299,7 @@ oss_read (sw_handle * handle, sw_audio_t * buf, size_t count)
#define PLAYBACK_SCALE (32768 / SW_AUDIO_T_MAX)
static ssize_t
-oss_write (sw_handle * handle, sw_audio_t * buf, size_t count)
+oss_write (sw_handle * handle, const sw_audio_t * buf, size_t count)
{
gint16 * bbuf;
size_t byte_count;
View
4 src/driver_pulseaudio.c
@@ -96,7 +96,7 @@ pulse_setup (sw_handle * handle, sw_format * format)
fprintf(stderr, __FILE__": pulse_setup(): The maximum number of channels supported is %d, while %d have been requested.\n", PA_CHANNELS_MAX, format->channels);
return;
}
-
+
ss.format = PA_SAMPLE_FLOAT32;
ss.rate = format->rate;
ss.channels = format->channels;
@@ -144,7 +144,7 @@ pulse_read (sw_handle * handle, sw_audio_t * buf, size_t count)
}
static ssize_t
-pulse_write (sw_handle * handle, sw_audio_t * buf, size_t count)
+pulse_write (sw_handle * handle, const sw_audio_t * buf, size_t count)
{
struct pa_simple * pa ;
int error;
View
2 src/driver_solaris.c
@@ -87,7 +87,7 @@ solaris_setup (sw_handle * handle, sw_format * format)
}
static ssize_t
-solaris_write (sw_handle * handle, void * buf, size_t count)
+solaris_write (sw_handle * handle, const void * buf, size_t count)
{
return write (handle->driver_fd, buf, count);
}

0 comments on commit 9ab4109

Please sign in to comment.