[beast: 27/29] DRIVERS: fix Bse::error checks
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 27/29] DRIVERS: fix Bse::error checks
- Date: Mon, 21 Mar 2016 15:14:29 +0000 (UTC)
commit 27d114dff43fc04c9b25881605c524d1c8a63865
Author: Tim Janik <timj gnu org>
Date: Mon Mar 7 01:54:20 2016 +0100
DRIVERS: fix Bse::error checks
Signed-off-by: Tim Janik <timj gnu org>
drivers/bsemididevice-alsa.cc | 8 ++++----
drivers/bsepcmdevice-alsa.cc | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/drivers/bsemididevice-alsa.cc b/drivers/bsemididevice-alsa.cc
index af7e31c..662c614 100644
--- a/drivers/bsemididevice-alsa.cc
+++ b/drivers/bsemididevice-alsa.cc
@@ -205,7 +205,7 @@ bse_midi_device_alsa_open (BseDevice *device,
snd_rawmidi_params_t *mparams = alsa_alloca0 (snd_rawmidi_params);
if (alsa->read_handle)
{
- if (!error && snd_rawmidi_params_current (alsa->read_handle, mparams) < 0)
+ if (error == 0 && snd_rawmidi_params_current (alsa->read_handle, mparams) < 0)
error = Bse::Error::FILE_OPEN_FAILED;
if (0)
printerr ("midiread: buffer=%zd active_sensing=%d min_avail=%zd\n",
@@ -215,7 +215,7 @@ bse_midi_device_alsa_open (BseDevice *device,
}
if (alsa->write_handle)
{
- if (!error && snd_rawmidi_params_current (alsa->write_handle, mparams) < 0)
+ if (error == 0 && snd_rawmidi_params_current (alsa->write_handle, mparams) < 0)
error = Bse::Error::FILE_OPEN_FAILED;
if (0)
printerr ("midiwrite: buffer=%zd active_sensing=%d min_avail=%zd\n",
@@ -223,11 +223,11 @@ bse_midi_device_alsa_open (BseDevice *device,
!snd_rawmidi_params_get_no_active_sensing (mparams),
snd_rawmidi_params_get_avail_min (mparams));
}
- if (!error && alsa->read_handle && snd_rawmidi_poll_descriptors_count (alsa->read_handle) <= 0)
+ if (error == 0 && alsa->read_handle && snd_rawmidi_poll_descriptors_count (alsa->read_handle) <= 0)
error = Bse::Error::FILE_OPEN_FAILED;
/* setup MIDI handle or shutdown */
- if (!error)
+ if (error == 0)
{
bse_device_set_opened (device, dname, alsa->read_handle != NULL, alsa->write_handle != NULL);
BSE_MIDI_DEVICE (device)->handle = handle;
diff --git a/drivers/bsepcmdevice-alsa.cc b/drivers/bsepcmdevice-alsa.cc
index 0f5e91e..9c68dff 100644
--- a/drivers/bsepcmdevice-alsa.cc
+++ b/drivers/bsepcmdevice-alsa.cc
@@ -232,23 +232,23 @@ bse_pcm_device_alsa_open (BseDevice *device,
if (!aerror && alsa->write_handle)
error = alsa_device_setup (alsa, alsa->write_handle, BSE_PCM_DEVICE (device)->req_latency_ms, &wh_freq,
&wh_n_periods, &wh_period_size);
/* check duplex */
- if (!error && alsa->read_handle && alsa->write_handle && rh_freq != wh_freq)
+ if (error == 0 && alsa->read_handle && alsa->write_handle && rh_freq != wh_freq)
error = Bse::Error::DEVICES_MISMATCH;
handle->mix_freq = alsa->read_handle ? rh_freq : wh_freq;
- if (!error && alsa->read_handle && alsa->write_handle && rh_n_periods != wh_n_periods)
+ if (error == 0 && alsa->read_handle && alsa->write_handle && rh_n_periods != wh_n_periods)
error = Bse::Error::DEVICES_MISMATCH;
alsa->n_periods = alsa->read_handle ? rh_n_periods : wh_n_periods;
- if (!error && alsa->read_handle && alsa->write_handle && rh_period_size != wh_period_size)
+ if (error == 0 && alsa->read_handle && alsa->write_handle && rh_period_size != wh_period_size)
error = Bse::Error::DEVICES_MISMATCH;
alsa->period_size = alsa->read_handle ? rh_period_size : wh_period_size;
- if (!error && alsa->read_handle && alsa->write_handle &&
+ if (error == 0 && alsa->read_handle && alsa->write_handle &&
snd_pcm_link (alsa->read_handle, alsa->write_handle) < 0)
error = Bse::Error::DEVICES_MISMATCH;
- if (!error && snd_pcm_prepare (alsa->read_handle ? alsa->read_handle : alsa->write_handle) < 0)
+ if (error == 0 && snd_pcm_prepare (alsa->read_handle ? alsa->read_handle : alsa->write_handle) < 0)
error = Bse::Error::FILE_OPEN_FAILED;
/* setup PCM handle or shutdown */
- if (!error)
+ if (error == 0)
{
alsa->period_buffer = (gint16*) g_malloc (alsa->period_size * alsa->frame_size);
bse_device_set_opened (device, dname, handle->readable, handle->writable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]