Changed audio subsystem's OpenDevice interface to return -1 on error.
This lets us 'return SDL_SetError("whatever");' on one line.
Fixes Bugzilla #1778.
1.1 --- a/src/audio/SDL_audio.c Sun Mar 31 12:48:50 2013 -0400
1.2 +++ b/src/audio/SDL_audio.c Sun Mar 31 13:05:40 2013 -0400
1.3 @@ -191,7 +191,7 @@
1.4 static int
1.5 SDL_AudioOpenDevice_Default(_THIS, const char *devname, int iscapture)
1.6 {
1.7 - return 0;
1.8 + return -1;
1.9 }
1.10
1.11 static void
1.12 @@ -940,7 +940,7 @@
1.13 ((!iscapture) && (current_audio.outputDevices == NULL)) )
1.14 SDL_GetNumAudioDevices(iscapture);
1.15
1.16 - if (!current_audio.impl.OpenDevice(device, devname, iscapture)) {
1.17 + if (current_audio.impl.OpenDevice(device, devname, iscapture) < 0) {
1.18 close_audio_device(device);
1.19 return 0;
1.20 }
2.1 --- a/src/audio/alsa/SDL_alsa_audio.c Sun Mar 31 12:48:50 2013 -0400
2.2 +++ b/src/audio/alsa/SDL_alsa_audio.c Sun Mar 31 13:05:40 2013 -0400
2.3 @@ -482,8 +482,7 @@
2.4 this->hidden = (struct SDL_PrivateAudioData *)
2.5 SDL_malloc((sizeof *this->hidden));
2.6 if (this->hidden == NULL) {
2.7 - SDL_OutOfMemory();
2.8 - return 0;
2.9 + return SDL_OutOfMemory();
2.10 }
2.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
2.12
2.13 @@ -495,9 +494,8 @@
2.14
2.15 if (status < 0) {
2.16 ALSA_CloseDevice(this);
2.17 - SDL_SetError("ALSA: Couldn't open audio device: %s",
2.18 - ALSA_snd_strerror(status));
2.19 - return 0;
2.20 + return SDL_SetError("ALSA: Couldn't open audio device: %s",
2.21 + ALSA_snd_strerror(status));
2.22 }
2.23
2.24 this->hidden->pcm_handle = pcm_handle;
2.25 @@ -507,9 +505,8 @@
2.26 status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
2.27 if (status < 0) {
2.28 ALSA_CloseDevice(this);
2.29 - SDL_SetError("ALSA: Couldn't get hardware config: %s",
2.30 - ALSA_snd_strerror(status));
2.31 - return 0;
2.32 + return SDL_SetError("ALSA: Couldn't get hardware config: %s",
2.33 + ALSA_snd_strerror(status));
2.34 }
2.35
2.36 /* SDL only uses interleaved sample output */
2.37 @@ -517,9 +514,8 @@
2.38 SND_PCM_ACCESS_RW_INTERLEAVED);
2.39 if (status < 0) {
2.40 ALSA_CloseDevice(this);
2.41 - SDL_SetError("ALSA: Couldn't set interleaved access: %s",
2.42 + return SDL_SetError("ALSA: Couldn't set interleaved access: %s",
2.43 ALSA_snd_strerror(status));
2.44 - return 0;
2.45 }
2.46
2.47 /* Try for a closest match on audio format */
2.48 @@ -572,8 +568,7 @@
2.49 }
2.50 if (status < 0) {
2.51 ALSA_CloseDevice(this);
2.52 - SDL_SetError("ALSA: Couldn't find any hardware audio formats");
2.53 - return 0;
2.54 + return SDL_SetError("ALSA: Couldn't find any hardware audio formats");
2.55 }
2.56 this->spec.format = test_format;
2.57
2.58 @@ -585,8 +580,7 @@
2.59 status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels);
2.60 if (status < 0) {
2.61 ALSA_CloseDevice(this);
2.62 - SDL_SetError("ALSA: Couldn't set audio channels");
2.63 - return 0;
2.64 + return SDL_SetError("ALSA: Couldn't set audio channels");
2.65 }
2.66 this->spec.channels = channels;
2.67 }
2.68 @@ -597,9 +591,8 @@
2.69 &rate, NULL);
2.70 if (status < 0) {
2.71 ALSA_CloseDevice(this);
2.72 - SDL_SetError("ALSA: Couldn't set audio frequency: %s",
2.73 - ALSA_snd_strerror(status));
2.74 - return 0;
2.75 + return SDL_SetError("ALSA: Couldn't set audio frequency: %s",
2.76 + ALSA_snd_strerror(status));
2.77 }
2.78 this->spec.freq = rate;
2.79
2.80 @@ -609,8 +602,7 @@
2.81 /* Failed to set desired buffer size, do the best you can... */
2.82 if ( ALSA_set_period_size(this, hwparams, 1) < 0 ) {
2.83 ALSA_CloseDevice(this);
2.84 - SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status));
2.85 - return(-1);
2.86 + return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status));
2.87 }
2.88 }
2.89 /* Set the software parameters */
2.90 @@ -618,31 +610,27 @@
2.91 status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams);
2.92 if (status < 0) {
2.93 ALSA_CloseDevice(this);
2.94 - SDL_SetError("ALSA: Couldn't get software config: %s",
2.95 - ALSA_snd_strerror(status));
2.96 - return 0;
2.97 + return SDL_SetError("ALSA: Couldn't get software config: %s",
2.98 + ALSA_snd_strerror(status));
2.99 }
2.100 status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples);
2.101 if (status < 0) {
2.102 ALSA_CloseDevice(this);
2.103 - SDL_SetError("Couldn't set minimum available samples: %s",
2.104 - ALSA_snd_strerror(status));
2.105 - return 0;
2.106 + return SDL_SetError("Couldn't set minimum available samples: %s",
2.107 + ALSA_snd_strerror(status));
2.108 }
2.109 status =
2.110 ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1);
2.111 if (status < 0) {
2.112 ALSA_CloseDevice(this);
2.113 - SDL_SetError("ALSA: Couldn't set start threshold: %s",
2.114 - ALSA_snd_strerror(status));
2.115 - return 0;
2.116 + return SDL_SetError("ALSA: Couldn't set start threshold: %s",
2.117 + ALSA_snd_strerror(status));
2.118 }
2.119 status = ALSA_snd_pcm_sw_params(pcm_handle, swparams);
2.120 if (status < 0) {
2.121 ALSA_CloseDevice(this);
2.122 - SDL_SetError("Couldn't set software audio parameters: %s",
2.123 - ALSA_snd_strerror(status));
2.124 - return 0;
2.125 + return SDL_SetError("Couldn't set software audio parameters: %s",
2.126 + ALSA_snd_strerror(status));
2.127 }
2.128
2.129 /* Calculate the final parameters for this audio specification */
2.130 @@ -653,8 +641,7 @@
2.131 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
2.132 if (this->hidden->mixbuf == NULL) {
2.133 ALSA_CloseDevice(this);
2.134 - SDL_OutOfMemory();
2.135 - return 0;
2.136 + return SDL_OutOfMemory();
2.137 }
2.138 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
2.139
2.140 @@ -662,7 +649,7 @@
2.141 ALSA_snd_pcm_nonblock(pcm_handle, 0);
2.142
2.143 /* We're ready to rock and roll. :-) */
2.144 - return 1;
2.145 + return 0;
2.146 }
2.147
2.148 static void
3.1 --- a/src/audio/android/SDL_androidaudio.c Sun Mar 31 12:48:50 2013 -0400
3.2 +++ b/src/audio/android/SDL_androidaudio.c Sun Mar 31 13:05:40 2013 -0400
3.3 @@ -42,21 +42,18 @@
3.4
3.5 if (iscapture) {
3.6 //TODO: implement capture
3.7 - SDL_SetError("Capture not supported on Android");
3.8 - return 0;
3.9 + return SDL_SetError("Capture not supported on Android");
3.10 }
3.11
3.12 if (audioDevice != NULL) {
3.13 - SDL_SetError("Only one audio device at a time please!");
3.14 - return 0;
3.15 + return SDL_SetError("Only one audio device at a time please!");
3.16 }
3.17
3.18 audioDevice = this;
3.19
3.20 this->hidden = SDL_malloc(sizeof(*(this->hidden)));
3.21 if (!this->hidden) {
3.22 - SDL_OutOfMemory();
3.23 - return 0;
3.24 + return SDL_OutOfMemory();
3.25 }
3.26 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
3.27
3.28 @@ -71,8 +68,7 @@
3.29
3.30 if (test_format == 0) {
3.31 // Didn't find a compatible format :(
3.32 - SDL_SetError("No compatible audio format!");
3.33 - return 0;
3.34 + return SDL_SetError("No compatible audio format!");
3.35 }
3.36
3.37 if (this->spec.channels > 1) {
3.38 @@ -94,11 +90,10 @@
3.39
3.40 if (this->spec.samples == 0) {
3.41 // Init failed?
3.42 - SDL_SetError("Java-side initialization failed!");
3.43 - return 0;
3.44 + return SDL_SetError("Java-side initialization failed!");
3.45 }
3.46
3.47 - return 1;
3.48 + return 0;
3.49 }
3.50
3.51 static void
4.1 --- a/src/audio/arts/SDL_artsaudio.c Sun Mar 31 12:48:50 2013 -0400
4.2 +++ b/src/audio/arts/SDL_artsaudio.c Sun Mar 31 13:05:40 2013 -0400
4.3 @@ -241,8 +241,7 @@
4.4 this->hidden = (struct SDL_PrivateAudioData *)
4.5 SDL_malloc((sizeof *this->hidden));
4.6 if (this->hidden == NULL) {
4.7 - SDL_OutOfMemory();
4.8 - return 0;
4.9 + return SDL_OutOfMemory();
4.10 }
4.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
4.12
4.13 @@ -271,22 +270,19 @@
4.14 }
4.15 if (format == 0) {
4.16 ARTS_CloseDevice(this);
4.17 - SDL_SetError("Couldn't find any hardware audio formats");
4.18 - return 0;
4.19 + return SDL_SetError("Couldn't find any hardware audio formats");
4.20 }
4.21 this->spec.format = test_format;
4.22
4.23 if ((rc = SDL_NAME(arts_init) ()) != 0) {
4.24 ARTS_CloseDevice(this);
4.25 - SDL_SetError("Unable to initialize ARTS: %s",
4.26 - SDL_NAME(arts_error_text) (rc));
4.27 - return 0;
4.28 + return SDL_SetError("Unable to initialize ARTS: %s",
4.29 + SDL_NAME(arts_error_text) (rc));
4.30 }
4.31
4.32 if (!ARTS_Suspend()) {
4.33 ARTS_CloseDevice(this);
4.34 - SDL_SetError("ARTS can not open audio device");
4.35 - return 0;
4.36 + return SDL_SetError("ARTS can not open audio device");
4.37 }
4.38
4.39 this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq,
4.40 @@ -304,8 +300,7 @@
4.41 for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec);
4.42 if ((0x01 << frag_spec) != this->spec.size) {
4.43 ARTS_CloseDevice(this);
4.44 - SDL_SetError("Fragment size must be a power of two");
4.45 - return 0;
4.46 + return SDL_SetError("Fragment size must be a power of two");
4.47 }
4.48 frag_spec |= 0x00020000; /* two fragments, for low latency */
4.49
4.50 @@ -326,8 +321,7 @@
4.51 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
4.52 if (this->hidden->mixbuf == NULL) {
4.53 ARTS_CloseDevice(this);
4.54 - SDL_OutOfMemory();
4.55 - return 0;
4.56 + return SDL_OutOfMemory();
4.57 }
4.58 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
4.59
4.60 @@ -335,7 +329,7 @@
4.61 this->hidden->parent = getpid();
4.62
4.63 /* We're ready to rock and roll. :-) */
4.64 - return 1;
4.65 + return 0;
4.66 }
4.67
4.68
5.1 --- a/src/audio/baudio/SDL_beaudio.cc Sun Mar 31 12:48:50 2013 -0400
5.2 +++ b/src/audio/baudio/SDL_beaudio.cc Sun Mar 31 13:05:40 2013 -0400
5.3 @@ -95,8 +95,7 @@
5.4 /* Initialize all variables that we clean on shutdown */
5.5 _this->hidden = new SDL_PrivateAudioData;
5.6 if (_this->hidden == NULL) {
5.7 - SDL_OutOfMemory();
5.8 - return 0;
5.9 + return SDL_OutOfMemory();
5.10 }
5.11 SDL_memset(_this->hidden, 0, (sizeof *_this->hidden));
5.12
5.13 @@ -153,8 +152,7 @@
5.14
5.15 if (!valid_datatype) { /* shouldn't happen, but just in case... */
5.16 BEOSAUDIO_CloseDevice(_this);
5.17 - SDL_SetError("Unsupported audio format");
5.18 - return 0;
5.19 + return SDL_SetError("Unsupported audio format");
5.20 }
5.21
5.22 /* Calculate the final parameters for this audio specification */
5.23 @@ -173,12 +171,11 @@
5.24 _this->hidden->audio_obj->SetHasData(true);
5.25 } else {
5.26 BEOSAUDIO_CloseDevice(_this);
5.27 - SDL_SetError("Unable to start Be audio");
5.28 - return 0;
5.29 + return SDL_SetError("Unable to start Be audio");
5.30 }
5.31
5.32 /* We're running! */
5.33 - return 1;
5.34 + return 0;
5.35 }
5.36
5.37 static void
6.1 --- a/src/audio/bsd/SDL_bsdaudio.c Sun Mar 31 12:48:50 2013 -0400
6.2 +++ b/src/audio/bsd/SDL_bsdaudio.c Sun Mar 31 13:05:40 2013 -0400
6.3 @@ -239,8 +239,7 @@
6.4 if (devname == NULL) {
6.5 devname = SDL_GetAudioDeviceName(0, iscapture);
6.6 if (devname == NULL) {
6.7 - SDL_SetError("No such audio device");
6.8 - return 0;
6.9 + return SDL_SetError("No such audio device");
6.10 }
6.11 }
6.12
6.13 @@ -248,16 +247,14 @@
6.14 this->hidden = (struct SDL_PrivateAudioData *)
6.15 SDL_malloc((sizeof *this->hidden));
6.16 if (this->hidden == NULL) {
6.17 - SDL_OutOfMemory();
6.18 - return 0;
6.19 + return SDL_OutOfMemory();
6.20 }
6.21 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
6.22
6.23 /* Open the audio device */
6.24 this->hidden->audio_fd = open(devname, flags, 0);
6.25 if (this->hidden->audio_fd < 0) {
6.26 - SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
6.27 - return 0;
6.28 + return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
6.29 }
6.30
6.31 AUDIO_INITINFO(&info);
6.32 @@ -269,8 +266,7 @@
6.33 info.mode = AUMODE_PLAY;
6.34 if (ioctl(this->hidden->audio_fd, AUDIO_SETINFO, &info) < 0) {
6.35 BSDAUDIO_CloseDevice(this);
6.36 - SDL_SetError("Couldn't put device into play mode");
6.37 - return 0;
6.38 + return SDL_SetError("Couldn't put device into play mode");
6.39 }
6.40
6.41 AUDIO_INITINFO(&info);
6.42 @@ -312,8 +308,7 @@
6.43
6.44 if (!format) {
6.45 BSDAUDIO_CloseDevice(this);
6.46 - SDL_SetError("No supported encoding for 0x%x", this->spec.format);
6.47 - return 0;
6.48 + return SDL_SetError("No supported encoding for 0x%x", this->spec.format);
6.49 }
6.50
6.51 this->spec.format = format;
6.52 @@ -336,15 +331,14 @@
6.53 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
6.54 if (this->hidden->mixbuf == NULL) {
6.55 BSDAUDIO_CloseDevice(this);
6.56 - SDL_OutOfMemory();
6.57 - return 0;
6.58 + return SDL_OutOfMemory();
6.59 }
6.60 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
6.61
6.62 BSDAUDIO_Status(this);
6.63
6.64 /* We're ready to rock and roll. :-) */
6.65 - return (0);
6.66 + return 0;
6.67 }
6.68
6.69 static int
7.1 --- a/src/audio/coreaudio/SDL_coreaudio.c Sun Mar 31 12:48:50 2013 -0400
7.2 +++ b/src/audio/coreaudio/SDL_coreaudio.c Sun Mar 31 13:05:40 2013 -0400
7.3 @@ -469,8 +469,7 @@
7.4 this->hidden = (struct SDL_PrivateAudioData *)
7.5 SDL_malloc((sizeof *this->hidden));
7.6 if (this->hidden == NULL) {
7.7 - SDL_OutOfMemory();
7.8 - return (0);
7.9 + return SDL_OutOfMemory();
7.10 }
7.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
7.12
7.13 @@ -511,8 +510,7 @@
7.14
7.15 if (!valid_datatype) { /* shouldn't happen, but just in case... */
7.16 COREAUDIO_CloseDevice(this);
7.17 - SDL_SetError("Unsupported audio format");
7.18 - return 0;
7.19 + return SDL_SetError("Unsupported audio format");
7.20 }
7.21
7.22 strdesc.mBytesPerFrame =
7.23 @@ -522,10 +520,10 @@
7.24
7.25 if (!prepare_audiounit(this, devname, iscapture, &strdesc)) {
7.26 COREAUDIO_CloseDevice(this);
7.27 - return 0; /* prepare_audiounit() will call SDL_SetError()... */
7.28 + return -1; /* prepare_audiounit() will call SDL_SetError()... */
7.29 }
7.30
7.31 - return 1; /* good to go. */
7.32 + return 0; /* good to go. */
7.33 }
7.34
7.35 static int
8.1 --- a/src/audio/directsound/SDL_directsound.c Sun Mar 31 12:48:50 2013 -0400
8.2 +++ b/src/audio/directsound/SDL_directsound.c Sun Mar 31 13:05:40 2013 -0400
8.3 @@ -363,8 +363,7 @@
8.4 DSSCL_NORMAL);
8.5 }
8.6 if (result != DS_OK) {
8.7 - SetDSerror("DirectSound SetCooperativeLevel", result);
8.8 - return (-1);
8.9 + return SetDSerror("DirectSound SetCooperativeLevel", result);
8.10 }
8.11
8.12 /* Try to create the secondary buffer */
8.13 @@ -449,8 +448,7 @@
8.14 pDirectSoundEnumerateW(FindDevGUID, &devguid);
8.15
8.16 if (!devguid.found) {
8.17 - SDL_SetError("DirectSound: Requested device not found");
8.18 - return 0;
8.19 + return SDL_SetError("DirectSound: Requested device not found");
8.20 }
8.21 guid = &devguid.guid;
8.22 }
8.23 @@ -459,8 +457,7 @@
8.24 this->hidden = (struct SDL_PrivateAudioData *)
8.25 SDL_malloc((sizeof *this->hidden));
8.26 if (this->hidden == NULL) {
8.27 - SDL_OutOfMemory();
8.28 - return 0;
8.29 + return SDL_OutOfMemory();
8.30 }
8.31 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
8.32
8.33 @@ -478,8 +475,7 @@
8.34
8.35 if (!valid_format) {
8.36 DSOUND_CloseDevice(this);
8.37 - SDL_SetError("DirectSound: Unsupported audio format");
8.38 - return 0;
8.39 + return SDL_SetError("DirectSound: Unsupported audio format");
8.40 }
8.41
8.42 SDL_memset(&waveformat, 0, sizeof(waveformat));
8.43 @@ -499,21 +495,20 @@
8.44 result = pDirectSoundCreate8(guid, &this->hidden->sound, NULL);
8.45 if (result != DS_OK) {
8.46 DSOUND_CloseDevice(this);
8.47 - SetDSerror("DirectSoundCreate", result);
8.48 - return 0;
8.49 + return SetDSerror("DirectSoundCreate", result);
8.50 }
8.51
8.52 /* Create the audio buffer to which we write */
8.53 this->hidden->num_buffers = CreateSecondary(this, NULL, &waveformat);
8.54 if (this->hidden->num_buffers < 0) {
8.55 DSOUND_CloseDevice(this);
8.56 - return 0;
8.57 + return -1;
8.58 }
8.59
8.60 /* The buffer will auto-start playing in DSOUND_WaitDevice() */
8.61 this->hidden->mixlen = this->spec.size;
8.62
8.63 - return 1; /* good to go. */
8.64 + return 0; /* good to go. */
8.65 }
8.66
8.67
9.1 --- a/src/audio/disk/SDL_diskaudio.c Sun Mar 31 12:48:50 2013 -0400
9.2 +++ b/src/audio/disk/SDL_diskaudio.c Sun Mar 31 13:05:40 2013 -0400
9.3 @@ -110,8 +110,7 @@
9.4 this->hidden = (struct SDL_PrivateAudioData *)
9.5 SDL_malloc(sizeof(*this->hidden));
9.6 if (this->hidden == NULL) {
9.7 - SDL_OutOfMemory();
9.8 - return 0;
9.9 + return SDL_OutOfMemory();
9.10 }
9.11 SDL_memset(this->hidden, 0, sizeof(*this->hidden));
9.12
9.13 @@ -119,14 +118,14 @@
9.14 this->hidden->output = SDL_RWFromFile(fname, "wb");
9.15 if (this->hidden->output == NULL) {
9.16 DISKAUD_CloseDevice(this);
9.17 - return 0;
9.18 + return -1;
9.19 }
9.20
9.21 /* Allocate mixing buffer */
9.22 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
9.23 if (this->hidden->mixbuf == NULL) {
9.24 DISKAUD_CloseDevice(this);
9.25 - return 0;
9.26 + return -1;
9.27 }
9.28 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
9.29
9.30 @@ -141,7 +140,7 @@
9.31 #endif
9.32
9.33 /* We're ready to rock and roll. :-) */
9.34 - return 1;
9.35 + return 0;
9.36 }
9.37
9.38 static int
10.1 --- a/src/audio/dsp/SDL_dspaudio.c Sun Mar 31 12:48:50 2013 -0400
10.2 +++ b/src/audio/dsp/SDL_dspaudio.c Sun Mar 31 13:05:40 2013 -0400
10.3 @@ -89,8 +89,7 @@
10.4 if (devname == NULL) {
10.5 devname = SDL_GetAudioDeviceName(0, iscapture);
10.6 if (devname == NULL) {
10.7 - SDL_SetError("No such audio device");
10.8 - return 0;
10.9 + return SDL_SetError("No such audio device");
10.10 }
10.11 }
10.12
10.13 @@ -107,8 +106,7 @@
10.14 this->hidden = (struct SDL_PrivateAudioData *)
10.15 SDL_malloc((sizeof *this->hidden));
10.16 if (this->hidden == NULL) {
10.17 - SDL_OutOfMemory();
10.18 - return 0;
10.19 + return SDL_OutOfMemory();
10.20 }
10.21 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
10.22
10.23 @@ -116,8 +114,7 @@
10.24 this->hidden->audio_fd = open(devname, flags, 0);
10.25 if (this->hidden->audio_fd < 0) {
10.26 DSP_CloseDevice(this);
10.27 - SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
10.28 - return 0;
10.29 + return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
10.30 }
10.31 this->hidden->mixbuf = NULL;
10.32
10.33 @@ -128,8 +125,7 @@
10.34 ctlflags &= ~O_NONBLOCK;
10.35 if (fcntl(this->hidden->audio_fd, F_SETFL, ctlflags) < 0) {
10.36 DSP_CloseDevice(this);
10.37 - SDL_SetError("Couldn't set audio blocking mode");
10.38 - return 0;
10.39 + return SDL_SetError("Couldn't set audio blocking mode");
10.40 }
10.41 }
10.42
10.43 @@ -137,8 +133,7 @@
10.44 if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) {
10.45 perror("SNDCTL_DSP_GETFMTS");
10.46 DSP_CloseDevice(this);
10.47 - SDL_SetError("Couldn't get audio format list");
10.48 - return 0;
10.49 + return SDL_SetError("Couldn't get audio format list");
10.50 }
10.51
10.52 /* Try for a closest match on audio format */
10.53 @@ -195,8 +190,7 @@
10.54 }
10.55 if (format == 0) {
10.56 DSP_CloseDevice(this);
10.57 - SDL_SetError("Couldn't find any hardware audio formats");
10.58 - return 0;
10.59 + return SDL_SetError("Couldn't find any hardware audio formats");
10.60 }
10.61 this->spec.format = test_format;
10.62
10.63 @@ -206,8 +200,7 @@
10.64 (value != format)) {
10.65 perror("SNDCTL_DSP_SETFMT");
10.66 DSP_CloseDevice(this);
10.67 - SDL_SetError("Couldn't set audio format");
10.68 - return 0;
10.69 + return SDL_SetError("Couldn't set audio format");
10.70 }
10.71
10.72 /* Set the number of channels of output */
10.73 @@ -215,8 +208,7 @@
10.74 if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0) {
10.75 perror("SNDCTL_DSP_CHANNELS");
10.76 DSP_CloseDevice(this);
10.77 - SDL_SetError("Cannot set the number of channels");
10.78 - return 0;
10.79 + return SDL_SetError("Cannot set the number of channels");
10.80 }
10.81 this->spec.channels = value;
10.82
10.83 @@ -225,8 +217,7 @@
10.84 if (ioctl(this->hidden->audio_fd, SNDCTL_DSP_SPEED, &value) < 0) {
10.85 perror("SNDCTL_DSP_SPEED");
10.86 DSP_CloseDevice(this);
10.87 - SDL_SetError("Couldn't set audio frequency");
10.88 - return 0;
10.89 + return SDL_SetError("Couldn't set audio frequency");
10.90 }
10.91 this->spec.freq = value;
10.92
10.93 @@ -237,8 +228,7 @@
10.94 for (frag_spec = 0; (0x01U << frag_spec) < this->spec.size; ++frag_spec);
10.95 if ((0x01U << frag_spec) != this->spec.size) {
10.96 DSP_CloseDevice(this);
10.97 - SDL_SetError("Fragment size must be a power of two");
10.98 - return 0;
10.99 + return SDL_SetError("Fragment size must be a power of two");
10.100 }
10.101 frag_spec |= 0x00020000; /* two fragments, for low latency */
10.102
10.103 @@ -266,13 +256,12 @@
10.104 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
10.105 if (this->hidden->mixbuf == NULL) {
10.106 DSP_CloseDevice(this);
10.107 - SDL_OutOfMemory();
10.108 - return 0;
10.109 + return SDL_OutOfMemory();
10.110 }
10.111 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
10.112
10.113 /* We're ready to rock and roll. :-) */
10.114 - return 1;
10.115 + return 0;
10.116 }
10.117
10.118
11.1 --- a/src/audio/dummy/SDL_dummyaudio.c Sun Mar 31 12:48:50 2013 -0400
11.2 +++ b/src/audio/dummy/SDL_dummyaudio.c Sun Mar 31 13:05:40 2013 -0400
11.3 @@ -29,7 +29,7 @@
11.4 static int
11.5 DUMMYAUD_OpenDevice(_THIS, const char *devname, int iscapture)
11.6 {
11.7 - return 1; /* always succeeds. */
11.8 + return 0; /* always succeeds. */
11.9 }
11.10
11.11 static int
12.1 --- a/src/audio/esd/SDL_esdaudio.c Sun Mar 31 12:48:50 2013 -0400
12.2 +++ b/src/audio/esd/SDL_esdaudio.c Sun Mar 31 13:05:40 2013 -0400
12.3 @@ -228,8 +228,7 @@
12.4 this->hidden = (struct SDL_PrivateAudioData *)
12.5 SDL_malloc((sizeof *this->hidden));
12.6 if (this->hidden == NULL) {
12.7 - SDL_OutOfMemory();
12.8 - return 0;
12.9 + return SDL_OutOfMemory();
12.10 }
12.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
12.12 this->hidden->audio_fd = -1;
12.13 @@ -257,8 +256,7 @@
12.14
12.15 if (!found) {
12.16 ESD_CloseDevice(this);
12.17 - SDL_SetError("Couldn't find any hardware audio formats");
12.18 - return 0;
12.19 + return SDL_SetError("Couldn't find any hardware audio formats");
12.20 }
12.21
12.22 if (this->spec.channels == 1) {
12.23 @@ -277,8 +275,7 @@
12.24
12.25 if (this->hidden->audio_fd < 0) {
12.26 ESD_CloseDevice(this);
12.27 - SDL_SetError("Couldn't open ESD connection");
12.28 - return 0;
12.29 + return SDL_SetError("Couldn't open ESD connection");
12.30 }
12.31
12.32 /* Calculate the final parameters for this audio specification */
12.33 @@ -292,8 +289,7 @@
12.34 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
12.35 if (this->hidden->mixbuf == NULL) {
12.36 ESD_CloseDevice(this);
12.37 - SDL_OutOfMemory();
12.38 - return 0;
12.39 + return SDL_OutOfMemory();
12.40 }
12.41 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
12.42
12.43 @@ -301,7 +297,7 @@
12.44 this->hidden->parent = getpid();
12.45
12.46 /* We're ready to rock and roll. :-) */
12.47 - return 1;
12.48 + return 0;
12.49 }
12.50
12.51 static void
13.1 --- a/src/audio/fusionsound/SDL_fsaudio.c Sun Mar 31 12:48:50 2013 -0400
13.2 +++ b/src/audio/fusionsound/SDL_fsaudio.c Sun Mar 31 13:05:40 2013 -0400
13.3 @@ -200,8 +200,7 @@
13.4 this->hidden = (struct SDL_PrivateAudioData *)
13.5 SDL_malloc((sizeof *this->hidden));
13.6 if (this->hidden == NULL) {
13.7 - SDL_OutOfMemory();
13.8 - return 0;
13.9 + return SDL_OutOfMemory();
13.10 }
13.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
13.12
13.13 @@ -243,8 +242,7 @@
13.14
13.15 if (format == 0) {
13.16 SDL_FS_CloseDevice(this);
13.17 - SDL_SetError("Couldn't find any hardware audio formats");
13.18 - return 0;
13.19 + return SDL_SetError("Couldn't find any hardware audio formats");
13.20 }
13.21 this->spec.format = test_format;
13.22
13.23 @@ -252,8 +250,7 @@
13.24 ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs);
13.25 if (ret) {
13.26 SDL_FS_CloseDevice(this);
13.27 - SDL_SetError("Unable to initialize FusionSound: %d", ret);
13.28 - return 0;
13.29 + return SDL_SetError("Unable to initialize FusionSound: %d", ret);
13.30 }
13.31
13.32 this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels;
13.33 @@ -272,8 +269,7 @@
13.34 &this->hidden->stream);
13.35 if (ret) {
13.36 SDL_FS_CloseDevice(this);
13.37 - SDL_SetError("Unable to create FusionSoundStream: %d", ret);
13.38 - return 0;
13.39 + return SDL_SetError("Unable to create FusionSoundStream: %d", ret);
13.40 }
13.41
13.42 /* See what we got */
13.43 @@ -294,13 +290,12 @@
13.44 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
13.45 if (this->hidden->mixbuf == NULL) {
13.46 SDL_FS_CloseDevice(this);
13.47 - SDL_OutOfMemory();
13.48 - return 0;
13.49 + return SDL_OutOfMemory();
13.50 }
13.51 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
13.52
13.53 /* We're ready to rock and roll. :-) */
13.54 - return 1;
13.55 + return 0;
13.56 }
13.57
13.58
14.1 --- a/src/audio/nas/SDL_nasaudio.c Sun Mar 31 12:48:50 2013 -0400
14.2 +++ b/src/audio/nas/SDL_nasaudio.c Sun Mar 31 13:05:40 2013 -0400
14.3 @@ -288,8 +288,7 @@
14.4 this->hidden = (struct SDL_PrivateAudioData *)
14.5 SDL_malloc((sizeof *this->hidden));
14.6 if (this->hidden == NULL) {
14.7 - SDL_OutOfMemory();
14.8 - return 0;
14.9 + return SDL_OutOfMemory();
14.10 }
14.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
14.12
14.13 @@ -304,24 +303,21 @@
14.14 }
14.15 if (format == 0) {
14.16 NAS_CloseDevice(this);
14.17 - SDL_SetError("NAS: Couldn't find any hardware audio formats");
14.18 - return 0;
14.19 + return SDL_SetError("NAS: Couldn't find any hardware audio formats");
14.20 }
14.21 this->spec.format = test_format;
14.22
14.23 this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
14.24 if (this->hidden->aud == 0) {
14.25 NAS_CloseDevice(this);
14.26 - SDL_SetError("NAS: Couldn't open connection to NAS server");
14.27 - return 0;
14.28 + return SDL_SetError("NAS: Couldn't open connection to NAS server");
14.29 }
14.30
14.31 this->hidden->dev = find_device(this, this->spec.channels);
14.32 if ((this->hidden->dev == AuNone)
14.33 || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) {
14.34 NAS_CloseDevice(this);
14.35 - SDL_SetError("NAS: Couldn't find a fitting device on NAS server");
14.36 - return 0;
14.37 + return SDL_SetError("NAS: Couldn't find a fitting device on NAS server");
14.38 }
14.39
14.40 buffer_size = this->spec.freq;
14.41 @@ -354,13 +350,12 @@
14.42 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
14.43 if (this->hidden->mixbuf == NULL) {
14.44 NAS_CloseDevice(this);
14.45 - SDL_OutOfMemory();
14.46 - return 0;
14.47 + return SDL_OutOfMemory();
14.48 }
14.49 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
14.50
14.51 /* We're ready to rock and roll. :-) */
14.52 - return 1;
14.53 + return 0;
14.54 }
14.55
14.56 static void
15.1 --- a/src/audio/paudio/SDL_paudio.c Sun Mar 31 12:48:50 2013 -0400
15.2 +++ b/src/audio/paudio/SDL_paudio.c Sun Mar 31 13:05:40 2013 -0400
15.3 @@ -264,8 +264,7 @@
15.4 this->hidden = (struct SDL_PrivateAudioData *)
15.5 SDL_malloc((sizeof *this->hidden));
15.6 if (this->hidden == NULL) {
15.7 - SDL_OutOfMemory();
15.8 - return 0;
15.9 + return SDL_OutOfMemory();
15.10 }
15.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
15.12
15.13 @@ -274,8 +273,7 @@
15.14 this->hidden->audio_fd = fd;
15.15 if (fd < 0) {
15.16 PAUDIO_CloseDevice(this);
15.17 - SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
15.18 - return 0;
15.19 + return SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
15.20 }
15.21
15.22 /*
15.23 @@ -284,8 +282,7 @@
15.24 */
15.25 if (ioctl(fd, AUDIO_BUFFER, &paud_bufinfo) < 0) {
15.26 PAUDIO_CloseDevice(this);
15.27 - SDL_SetError("Couldn't get audio buffer information");
15.28 - return 0;
15.29 + return SDL_SetError("Couldn't get audio buffer information");
15.30 }
15.31
15.32 if (this->spec.channels > 1)
15.33 @@ -399,8 +396,7 @@
15.34 fprintf(stderr, "Couldn't find any hardware audio formats\n");
15.35 #endif
15.36 PAUDIO_CloseDevice(this);
15.37 - SDL_SetError("Couldn't find any hardware audio formats");
15.38 - return 0;
15.39 + return SDL_SetError("Couldn't find any hardware audio formats");
15.40 }
15.41 this->spec.format = test_format;
15.42
15.43 @@ -458,8 +454,7 @@
15.44
15.45 if (err != NULL) {
15.46 PAUDIO_CloseDevice(this);
15.47 - SDL_SetError("Paudio: %s", err);
15.48 - return 0;
15.49 + return SDL_SetError("Paudio: %s", err);
15.50 }
15.51
15.52 /* Allocate mixing buffer */
15.53 @@ -467,8 +462,7 @@
15.54 this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
15.55 if (this->hidden->mixbuf == NULL) {
15.56 PAUDIO_CloseDevice(this);
15.57 - SDL_OutOfMemory();
15.58 - return 0;
15.59 + return SDL_OutOfMemory();
15.60 }
15.61 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
15.62
15.63 @@ -506,8 +500,7 @@
15.64 #ifdef DEBUG_AUDIO
15.65 fprintf(stderr, "Can't start audio play\n");
15.66 #endif
15.67 - SDL_SetError("Can't start audio play");
15.68 - return 0;
15.69 + return SDL_SetError("Can't start audio play");
15.70 }
15.71
15.72 /* Check to see if we need to use select() workaround */
15.73 @@ -518,7 +511,7 @@
15.74 }
15.75
15.76 /* We're ready to rock and roll. :-) */
15.77 - return 1;
15.78 + return 0;
15.79 }
15.80
15.81 static int
16.1 --- a/src/audio/psp/SDL_pspaudio.c Sun Mar 31 12:48:50 2013 -0400
16.2 +++ b/src/audio/psp/SDL_pspaudio.c Sun Mar 31 13:05:40 2013 -0400
16.3 @@ -46,8 +46,7 @@
16.4 this->hidden = (struct SDL_PrivateAudioData *)
16.5 SDL_malloc(sizeof(*this->hidden));
16.6 if (this->hidden == NULL) {
16.7 - SDL_OutOfMemory();
16.8 - return 0;
16.9 + return SDL_OutOfMemory();
16.10 }
16.11 SDL_memset(this->hidden, 0, sizeof(*this->hidden));
16.12 switch (this->spec.format & 0xff) {
16.13 @@ -56,8 +55,7 @@
16.14 this->spec.format = AUDIO_S16LSB;
16.15 break;
16.16 default:
16.17 - SDL_SetError("Unsupported audio format");
16.18 - return 0;
16.19 + return SDL_SetError("Unsupported audio format");
16.20 }
16.21
16.22 /* The sample count must be a multiple of 64. */
16.23 @@ -86,8 +84,7 @@
16.24 mixlen = this->spec.size * NUM_BUFFERS;
16.25 this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen);
16.26 if (this->hidden->rawbuf == NULL) {
16.27 - SDL_SetError("Couldn't allocate mixing buffer");
16.28 - return 0;
16.29 + return SDL_SetError("Couldn't allocate mixing buffer");
16.30 }
16.31
16.32 /* Setup the hardware channel. */
16.33 @@ -98,10 +95,9 @@
16.34 }
16.35 this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format);
16.36 if (this->hidden->channel < 0) {
16.37 - SDL_SetError("Couldn't reserve hardware channel");
16.38 free(this->hidden->rawbuf);
16.39 this->hidden->rawbuf = NULL;
16.40 - return 0;
16.41 + return SDL_SetError("Couldn't reserve hardware channel");
16.42 }
16.43
16.44 memset(this->hidden->rawbuf, 0, mixlen);
16.45 @@ -110,7 +106,7 @@
16.46 }
16.47
16.48 this->hidden->next_buffer = 0;
16.49 - return 1;
16.50 + return 0;
16.51 }
16.52
16.53 static void PSPAUD_PlayDevice(_THIS)
17.1 --- a/src/audio/pulseaudio/SDL_pulseaudio.c Sun Mar 31 12:48:50 2013 -0400
17.2 +++ b/src/audio/pulseaudio/SDL_pulseaudio.c Sun Mar 31 13:05:40 2013 -0400
17.3 @@ -337,8 +337,7 @@
17.4 this->hidden = (struct SDL_PrivateAudioData *)
17.5 SDL_malloc((sizeof *this->hidden));
17.6 if (this->hidden == NULL) {
17.7 - SDL_OutOfMemory();
17.8 - return 0;
17.9 + return SDL_OutOfMemory();
17.10 }
17.11 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
17.12 h = this->hidden;
17.13 @@ -371,8 +370,7 @@
17.14 }
17.15 if (paspec.format == PA_SAMPLE_INVALID) {
17.16 PULSEAUDIO_CloseDevice(this);
17.17 - SDL_SetError("Couldn't find any hardware audio formats");
17.18 - return 0;
17.19 + return SDL_SetError("Couldn't find any hardware audio formats");
17.20 }
17.21 this->spec.format = test_format;
17.22
17.23 @@ -387,8 +385,7 @@
17.24 h->mixbuf = (Uint8 *) SDL_AllocAudioMem(h->mixlen);
17.25 if (h->mixbuf == NULL) {
17.26 PULSEAUDIO_CloseDevice(this);
17.27 - SDL_OutOfMemory();
17.28 - return 0;
17.29 + return SDL_OutOfMemory();
17.30 }
17.31 SDL_memset(h->mixbuf, this->spec.silence, this->spec.size);
17.32
17.33 @@ -419,36 +416,31 @@
17.34 /* Set up a new main loop */
17.35 if (!(h->mainloop = PULSEAUDIO_pa_mainloop_new())) {
17.36 PULSEAUDIO_CloseDevice(this);
17.37 - SDL_SetError("pa_mainloop_new() failed");
17.38 - return 0;
17.39 + return SDL_SetError("pa_mainloop_new() failed");
17.40 }
17.41
17.42 h->mainloop_api = PULSEAUDIO_pa_mainloop_get_api(h->mainloop);
17.43 h->context = PULSEAUDIO_pa_context_new(h->mainloop_api, NULL);
17.44 if (!h->context) {
17.45 PULSEAUDIO_CloseDevice(this);
17.46 - SDL_SetError("pa_context_new() failed");
17.47 - return 0;
17.48 + return SDL_SetError("pa_context_new() failed");
17.49 }
17.50
17.51 /* Connect to the PulseAudio server */
17.52 if (PULSEAUDIO_pa_context_connect(h->context, NULL, 0, NULL) < 0) {
17.53 PULSEAUDIO_CloseDevice(this);
17.54 - SDL_SetError("Could not setup connection to PulseAudio");
17.55 - return 0;
17.56 + return SDL_SetError("Could not setup connection to PulseAudio");
17.57 }
17.58
17.59 do {
17.60 if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
17.61 PULSEAUDIO_CloseDevice(this);
17.62 - SDL_SetError("pa_mainloop_iterate() failed");
17.63 - return 0;
17.64 + return SDL_SetError("pa_mainloop_iterate() failed");
17.65 }
17.66 state = PULSEAUDIO_pa_context_get_state(h->context);
17.67 if (!PA_CONTEXT_IS_GOOD(state)) {
17.68 PULSEAUDIO_CloseDevice(this);
17.69 - SDL_SetError("Could not connect to PulseAudio");
17.70 - return 0;
17.71 + return SDL_SetError("Could not connect to PulseAudio");
17.72 }
17.73 } while (state != PA_CONTEXT_READY);
17.74
17.75 @@ -461,33 +453,29 @@
17.76
17.77 if (h->stream == NULL) {
17.78 PULSEAUDIO_CloseDevice(this);
17.79 - SDL_SetError("Could not set up PulseAudio stream");
17.80 - return 0;
17.81 + return SDL_SetError("Could not set up PulseAudio stream");
17.82 }
17.83
17.84 if (PULSEAUDIO_pa_stream_connect_playback(h->stream, NULL, &paattr, flags,
17.85 NULL, NULL) < 0) {
17.86 PULSEAUDIO_CloseDevice(this);
17.87 - SDL_SetError("Could not connect PulseAudio stream");
17.88 - return 0;
17.89 + return SDL_SetError("Could not connect PulseAudio stream");
17.90 }
17.91
17.92 do {
17.93 if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) {
17.94 PULSEAUDIO_CloseDevice(this);
17.95 - SDL_SetError("pa_mainloop_iterate() failed");
17.96 - return 0;
17.97 + return SDL_SetError("pa_mainloop_iterate() failed");
17.98 }
17.99 state = PULSEAUDIO_pa_stream_get_state(h->stream);
17.100 if (!PA_STREAM_IS_GOOD(state)) {
17.101 PULSEAUDIO_CloseDevice(this);
17.102 - SDL_SetError("Could not create to PulseAudio stream");
17.103 - return 0;
17.104 + return SDL_SetError("Could not create to PulseAudio stream");
17.105 }
17.106 } while (state != PA_STREAM_READY);
17.107
17.108 /* We're ready to rock and roll. :-) */
17.109 - return 1;
17.110 + return 0;
17.111 }
17.112
17.113
18.1 --- a/src/audio/qsa/SDL_qsa_audio.c Sun Mar 31 12:48:50 2013 -0400
18.2 +++ b/src/audio/qsa/SDL_qsa_audio.c Sun Mar 31 13:05:40 2013 -0400
18.3 @@ -83,10 +83,10 @@
18.4 QSA_Device qsa_capture_device[QSA_MAX_DEVICES];
18.5 uint32_t qsa_capture_devices;
18.6
18.7 -static inline void
18.8 +static inline int
18.9 QSA_SetError(const char *fn, int status)
18.10 {
18.11 - SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
18.12 + return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
18.13 }
18.14
18.15 /* card names check to apply the workarounds */
18.16 @@ -183,13 +183,13 @@
18.17 switch (selectret) {
18.18 case -1:
18.19 {
18.20 - SDL_SetError("QSA: select() failed: %s\n", strerror(errno));
18.21 + SDL_SetError("QSA: select() failed: %s", strerror(errno));
18.22 return;
18.23 }
18.24 break;
18.25 case 0:
18.26 {
18.27 - SDL_SetError("QSA: timeout on buffer waiting occured\n");
18.28 + SDL_SetError("QSA: timeout on buffer waiting occured");
18.29 this->hidden->timeout_on_wait = 1;
18.30 return;
18.31 }
18.32 @@ -237,7 +237,7 @@
18.33 /* the audio device driver */
18.34 if ((errno == EAGAIN) && (written == 0)) {
18.35 if (this->hidden->timeout_on_wait != 0) {
18.36 - SDL_SetError("QSA: buffer playback timeout\n");
18.37 + SDL_SetError("QSA: buffer playback timeout");
18.38 return;
18.39 }
18.40 }
18.41 @@ -355,8 +355,7 @@
18.42 (struct
18.43 SDL_PrivateAudioData)));
18.44 if (this->hidden == NULL) {
18.45 - SDL_OutOfMemory();
18.46 - return 0;
18.47 + return SDL_OutOfMemory();
18.48 }
18.49 SDL_memset(this->hidden, 0, sizeof(struct SDL_PrivateAudioData));
18.50
18.51 @@ -384,8 +383,7 @@
18.52 device++;
18.53 if (device >= qsa_playback_devices) {
18.54 QSA_CloseDevice(this);
18.55 - SDL_SetError("No such playback device");
18.56 - return 0;
18.57 + return SDL_SetError("No such playback device");
18.58 }
18.59 } while (1);
18.60 }
18.61 @@ -409,8 +407,7 @@
18.62 device++;
18.63 if (device >= qsa_capture_devices) {
18.64 QSA_CloseDevice(this);
18.65 - SDL_SetError("No such capture device");
18.66 - return 0;
18.67 + return SDL_SetError("No such capture device");
18.68 }
18.69 } while (1);
18.70 }
18.71 @@ -448,8 +445,7 @@
18.72 if (status < 0) {
18.73 this->hidden->audio_handle = NULL;
18.74 QSA_CloseDevice(this);
18.75 - QSA_SetError("snd_pcm_open", status);
18.76 - return 0;
18.77 + return QSA_SetError("snd_pcm_open", status);
18.78 }
18.79
18.80 if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) {
18.81 @@ -459,8 +455,7 @@
18.82 PLUGIN_DISABLE_MMAP);
18.83 if (status < 0) {
18.84 QSA_CloseDevice(this);
18.85 - QSA_SetError("snd_pcm_plugin_set_disable", status);
18.86 - return 0;
18.87 + return QSA_SetError("snd_pcm_plugin_set_disable", status);
18.88 }
18.89 }
18.90
18.91 @@ -546,8 +541,7 @@
18.92 /* assumes test_format not 0 on success */
18.93 if (test_format == 0) {
18.94 QSA_CloseDevice(this);
18.95 - SDL_SetError("QSA: Couldn't find any hardware audio formats");
18.96 - return 0;
18.97 + return SDL_SetError("QSA: Couldn't find any hardware audio formats");
18.98 }
18.99
18.100 this->spec.format = test_format;
18.101 @@ -565,8 +559,7 @@
18.102 status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams);
18.103 if (status < 0) {
18.104 QSA_CloseDevice(this);
18.105 - QSA_SetError("snd_pcm_channel_params", status);
18.106 - return 0;
18.107 + return QSA_SetError("snd_pcm_channel_params", status);
18.108 }
18.109
18.110 /* Make sure channel is setup right one last time */
18.111 @@ -580,8 +573,7 @@
18.112 /* Setup an audio channel */
18.113 if (snd_pcm_plugin_setup(this->hidden->audio_handle, &csetup) < 0) {
18.114 QSA_CloseDevice(this);
18.115 - SDL_SetError("QSA: Unable to setup channel\n");
18.116 - return 0;
18.117 + return SDL_SetError("QSA: Unable to setup channel");
18.118 }
18.119
18.120 /* Calculate the final parameters for this audio specification */
18.121 @@ -604,8 +596,7 @@
18.122 (Uint8 *) SDL_AllocAudioMem(this->hidden->pcm_len);
18.123 if (this->hidden->pcm_buf == NULL) {
18.124 QSA_CloseDevice(this);
18.125 - SDL_OutOfMemory();
18.126 - return 0;
18.127 + return SDL_OutOfMemory();
18.128 }
18.129 SDL_memset(this->hidden->pcm_buf, this->spec.silence,
18.130 this->hidden->pcm_len);
18.131 @@ -623,8 +614,7 @@
18.132
18.133 if (this->hidden->audio_fd < 0) {
18.134 QSA_CloseDevice(this);
18.135 - QSA_SetError("snd_pcm_file_descriptor", status);
18.136 - return 0;
18.137 + return QSA_SetError("snd_pcm_file_descriptor", status);
18.138 }
18.139
18.140 /* Prepare an audio channel */
18.141 @@ -642,12 +632,11 @@
18.142
18.143 if (status < 0) {
18.144 QSA_CloseDevice(this);
18.145 - QSA_SetError("snd_pcm_plugin_prepare", status);
18.146 - return 0;
18.147 + return QSA_SetError("snd_pcm_plugin_prepare", status);
18.148 }
18.149
18.150 /* We're really ready to rock and roll. :-) */
18.151 - return 1;
18.152 + return 0;
18.153 }
18.154
18.155 static void
19.1 --- a/src/audio/sun/SDL_sunaudio.c Sun Mar 31 12:48:50 2013 -0400
19.2 +++ b/src/audio/sun/SDL_sunaudio.c Sun Mar 31 13:05:40 2013 -0400
19.3 @@ -213,8 +213,7 @@
19.4 if (devname == NULL) {
19.5 devname = SDL_GetAudioDeviceName(0, iscapture);
19.6 if (devname == NULL) {
19.7 - SDL_SetError("No such audio device");
19.8 - return 0;
19.9 + return SDL_SetError("No such audio device");
19.10 }
19.11 }
19.12
19.13 @@ -222,16 +221,14 @@
19.14 this->hidden = (struct SDL_PrivateAudioData *)
19.15 SDL_malloc((sizeof *this->hidden));
19.16 if (this->hidden == NULL) {
19.17 - SDL_OutOfMemory();
19.18 - return 0;
19.19 + return SDL_OutOfMemory();
19.20 }
19.21 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
19.22
19.23 /* Open the audio device */
19.24 this->hidden->audio_fd = open(devname, flags, 0);
19.25 if (this->hidden->audio_fd < 0) {
19.26 - SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
19.27 - return 0;
19.28 + return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno));
19.29 }
19.30
19.31 #ifdef AUDIO_SETINFO
19.32 @@ -263,8 +260,7 @@
19.33 default:
19.34 {
19.35 /* !!! FIXME: fallback to conversion on unsupported types! */
19.36 - SDL_SetError("Unsupported audio format");
19.37 - return (-1);
19.38 + return SDL_SetError("Unsupported audio format");
19.39 }
19.40 }
19.41 this->hidden->audio_fmt = this->spec.format;
19.42 @@ -285,9 +281,8 @@
19.43
19.44 /* Check to be sure we got what we wanted */
19.45 if (ioctl(this->hidden->audio_fd, AUDIO_GETINFO, &info) < 0) {
19.46 - SDL_SetError("Error getting audio parameters: %s",
19.47 - strerror(errno));
19.48 - return -1;
19.49 + return SDL_SetError("Error getting audio parameters: %s",
19.50 + strerror(errno));
19.51 }
19.52 if (info.play.encoding == enc
19.53 && info.play.precision == (this->spec.format & 0xff)
19.54 @@ -316,9 +311,8 @@
19.55
19.56 default:
19.57 /* oh well... */
19.58 - SDL_SetError("Error setting audio parameters: %s",
19.59 - strerror(errno));
19.60 - return -1;
19.61 + return SDL_SetError("Error setting audio parameters: %s",
19.62 + strerror(errno));
19.63 }
19.64 }
19.65 #endif /* AUDIO_SETINFO */
19.66 @@ -357,7 +351,7 @@
19.67 SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
19.68
19.69 /* We're ready to rock and roll. :-) */
19.70 - return (1);
19.71 + return 0;
19.72 }
19.73
19.74 /************************************************************************/
20.1 --- a/src/audio/winmm/SDL_winmm.c Sun Mar 31 12:48:50 2013 -0400
20.2 +++ b/src/audio/winmm/SDL_winmm.c Sun Mar 31 13:05:40 2013 -0400
20.3 @@ -91,7 +91,7 @@
20.4 ReleaseSemaphore(this->hidden->audio_sem, 1, NULL);
20.5 }
20.6
20.7 -static void
20.8 +static int
20.9 SetMMerror(char *function, MMRESULT code)
20.10 {
20.11 size_t len;
20.12 @@ -105,7 +105,7 @@
20.13 WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len,
20.14 MAXERRORLENGTH - len, NULL, NULL);
20.15
20.16 - SDL_SetError("%s", errbuf);
20.17 + return SDL_SetError("%s", errbuf);
20.18 }
20.19
20.20 static void
20.21 @@ -234,8 +234,7 @@
20.22 }
20.23
20.24 if (devId == WAVE_MAPPER) {
20.25 - SDL_SetError("Requested device not found");
20.26 - return 0;
20.27 + return SDL_SetError("Requested device not found");
20.28 }
20.29 }
20.30
20.31 @@ -243,8 +242,7 @@
20.32 this->hidden = (struct SDL_PrivateAudioData *)
20.33 SDL_malloc((sizeof *this->hidden));
20.34 if (this->hidden == NULL) {
20.35 - SDL_OutOfMemory();
20.36 - return 0;
20.37 + return SDL_OutOfMemory();
20.38 }
20.39 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
20.40
20.41 @@ -270,8 +268,7 @@
20.42
20.43 if (!valid_datatype) {
20.44 WINMM_CloseDevice(this);
20.45 - SDL_SetError("Unsupported audio format");
20.46 - return 0;
20.47 + return SDL_SetError("Unsupported audio format");
20.48 }
20.49
20.50 /* Set basic WAVE format parameters */
20.51 @@ -309,8 +306,7 @@
20.52
20.53 if (result != MMSYSERR_NOERROR) {
20.54 WINMM_CloseDevice(this);
20.55 - SetMMerror("waveOutOpen()", result);
20.56 - return 0;
20.57 + return SetMMerror("waveOutOpen()", result);
20.58 }
20.59 #ifdef SOUND_DEBUG
20.60 /* Check the sound device we retrieved */
20.61 @@ -321,8 +317,7 @@
20.62 &caps, sizeof(caps));
20.63 if (result != MMSYSERR_NOERROR) {
20.64 WINMM_CloseDevice(this);
20.65 - SetMMerror("waveOutGetDevCaps()", result);
20.66 - return 0;
20.67 + return SetMMerror("waveOutGetDevCaps()", result);
20.68 }
20.69 printf("Audio device: %s\n", caps.szPname);
20.70 }
20.71 @@ -333,8 +328,7 @@
20.72 CreateSemaphore(NULL, NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
20.73 if (this->hidden->audio_sem == NULL) {
20.74 WINMM_CloseDevice(this);
20.75 - SDL_SetError("Couldn't create semaphore");
20.76 - return 0;
20.77 + return SDL_SetError("Couldn't create semaphore");
20.78 }
20.79
20.80 /* Create the sound buffers */
20.81 @@ -342,8 +336,7 @@
20.82 (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size);
20.83 if (this->hidden->mixbuf == NULL) {
20.84 WINMM_CloseDevice(this);
20.85 - SDL_OutOfMemory();
20.86 - return 0;
20.87 + return SDL_OutOfMemory();
20.88 }
20.89 for (i = 0; i < NUM_BUFFERS; ++i) {
20.90 SDL_memset(&this->hidden->wavebuf[i], 0,
20.91 @@ -357,12 +350,11 @@
20.92 sizeof(this->hidden->wavebuf[i]));
20.93 if (result != MMSYSERR_NOERROR) {
20.94 WINMM_CloseDevice(this);
20.95 - SetMMerror("waveOutPrepareHeader()", result);
20.96 - return 0;
20.97 + return SetMMerror("waveOutPrepareHeader()", result);
20.98 }
20.99 }
20.100
20.101 - return 1; /* Ready to go! */
20.102 + return 0; /* Ready to go! */
20.103 }
20.104
20.105
21.1 --- a/src/audio/xaudio2/SDL_xaudio2.c Sun Mar 31 12:48:50 2013 -0400
21.2 +++ b/src/audio/xaudio2/SDL_xaudio2.c Sun Mar 31 13:05:40 2013 -0400
21.3 @@ -245,11 +245,9 @@
21.4 static IXAudio2VoiceCallback callbacks = { &callbacks_vtable };
21.5
21.6 if (iscapture) {
21.7 - SDL_SetError("XAudio2: capture devices unsupported.");
21.8 - return 0;
21.9 + return SDL_SetError("XAudio2: capture devices unsupported.");
21.10 } else if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) {
21.11 - SDL_SetError("XAudio2: XAudio2Create() failed.");
21.12 - return 0;
21.13 + return SDL_SetError("XAudio2: XAudio2Create() failed.");
21.14 }
21.15
21.16 if (devname != NULL) {
21.17 @@ -258,8 +256,7 @@
21.18
21.19 if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) {
21.20 IXAudio2_Release(ixa2);
21.21 - SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed.");
21.22 - return 0;
21.23 + return SDL_SetError("XAudio2: IXAudio2_GetDeviceCount() failed.");
21.24 }
21.25 for (i = 0; i < devcount; i++) {
21.26 XAUDIO2_DEVICE_DETAILS details;
21.27 @@ -278,8 +275,7 @@
21.28
21.29 if (i == devcount) {
21.30 IXAudio2_Release(ixa2);
21.31 - SDL_SetError("XAudio2: Requested device not found.");
21.32 - return 0;
21.33 + return SDL_SetError("XAudio2: Requested device not found.");
21.34 }
21.35 }
21.36
21.37 @@ -288,8 +284,7 @@
21.38 SDL_malloc((sizeof *this->hidden));
21.39 if (this->hidden == NULL) {
21.40 IXAudio2_Release(ixa2);
21.41 - SDL_OutOfMemory();
21.42 - return 0;
21.43 + return SDL_OutOfMemory();
21.44 }
21.45 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
21.46
21.47 @@ -297,8 +292,7 @@
21.48 this->hidden->semaphore = CreateSemaphore(NULL, 1, 2, NULL);
21.49 if (this->hidden->semaphore == NULL) {
21.50 XAUDIO2_CloseDevice(this);
21.51 - SDL_SetError("XAudio2: CreateSemaphore() failed!");
21.52 - return 0;
21.53 + return SDL_SetError("XAudio2: CreateSemaphore() failed!");
21.54 }
21.55
21.56 while ((!valid_format) && (test_format)) {
21.57 @@ -316,8 +310,7 @@
21.58
21.59 if (!valid_format) {
21.60 XAUDIO2_CloseDevice(this);
21.61 - SDL_SetError("XAudio2: Unsupported audio format");
21.62 - return 0;
21.63 + return SDL_SetError("XAudio2: Unsupported audio format");
21.64 }
21.65
21.66 /* Update the fragment size as size in bytes */
21.67 @@ -328,8 +321,7 @@
21.68 this->hidden->mixbuf = (Uint8 *) SDL_malloc(2 * this->hidden->mixlen);
21.69 if (this->hidden->mixbuf == NULL) {
21.70 XAUDIO2_CloseDevice(this);
21.71 - SDL_OutOfMemory();
21.72 - return 0;
21.73 + return SDL_OutOfMemory();
21.74 }
21.75 this->hidden->nextbuf = this->hidden->mixbuf;
21.76 SDL_memset(this->hidden->mixbuf, 0, 2 * this->hidden->mixlen);
21.77 @@ -345,8 +337,7 @@
21.78 this->spec.freq, 0, devId, NULL);
21.79 if (result != S_OK) {
21.80 XAUDIO2_CloseDevice(this);
21.81 - SDL_SetError("XAudio2: Couldn't create mastering voice");
21.82 - return 0;
21.83 + return SDL_SetError("XAudio2: Couldn't create mastering voice");
21.84 }
21.85
21.86 SDL_zero(waveformat);
21.87 @@ -369,8 +360,7 @@
21.88 1.0f, &callbacks, NULL, NULL);
21.89 if (result != S_OK) {
21.90 XAUDIO2_CloseDevice(this);
21.91 - SDL_SetError("XAudio2: Couldn't create source voice");
21.92 - return 0;
21.93 + return SDL_SetError("XAudio2: Couldn't create source voice");
21.94 }
21.95 this->hidden->source = source;
21.96
21.97 @@ -378,18 +368,16 @@
21.98 result = IXAudio2_StartEngine(ixa2);
21.99 if (result != S_OK) {
21.100 XAUDIO2_CloseDevice(this);
21.101 - SDL_SetError("XAudio2: Couldn't start engine");
21.102 - return 0;
21.103 + return SDL_SetError("XAudio2: Couldn't start engine");
21.104 }
21.105
21.106 result = IXAudio2SourceVoice_Start(source, 0, XAUDIO2_COMMIT_NOW);
21.107 if (result != S_OK) {
21.108 XAUDIO2_CloseDevice(this);
21.109 - SDL_SetError("XAudio2: Couldn't start source voice");
21.110 - return 0;
21.111 + return SDL_SetError("XAudio2: Couldn't start source voice");
21.112 }
21.113
21.114 - return 1; /* good to go. */
21.115 + return 0; /* good to go. */
21.116 }
21.117
21.118 static void