aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/alsa_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-29 20:40:27 +0100
committerMax Kellermann <max@duempel.org>2008-10-29 20:40:27 +0100
commit58c5bee9f0bcb46da7d113b66a4e1e2d7add9837 (patch)
tree4517d2156aa3643247e7f2fc886af86d3dfd8791 /src/output/alsa_plugin.c
parent03390d8be1cb8983778faf6eedb9bcfd26a6dbce (diff)
downloadmpd-58c5bee9f0bcb46da7d113b66a4e1e2d7add9837.tar.gz
mpd-58c5bee9f0bcb46da7d113b66a4e1e2d7add9837.tar.xz
mpd-58c5bee9f0bcb46da7d113b66a4e1e2d7add9837.zip
output: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
Diffstat (limited to '')
-rw-r--r--src/output/alsa_plugin.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index e812e49fc..2d4f9c239 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -125,7 +125,7 @@ static void alsa_finishDriver(void *data)
freeAlsaData(ad);
}
-static int alsa_testDefault(void)
+static bool alsa_testDefault(void)
{
snd_pcm_t *handle;
@@ -134,11 +134,11 @@ static int alsa_testDefault(void)
if (ret) {
WARNING("Error opening default ALSA device: %s\n",
snd_strerror(-ret));
- return -1;
+ return false;
} else
snd_pcm_close(handle);
- return 0;
+ return true;
}
static snd_pcm_format_t get_bitformat(const struct audio_format *af)
@@ -152,7 +152,7 @@ static snd_pcm_format_t get_bitformat(const struct audio_format *af)
return SND_PCM_FORMAT_UNKNOWN;
}
-static int alsa_openDevice(void *data, struct audio_format *audioFormat)
+static bool alsa_openDevice(void *data, struct audio_format *audioFormat)
{
AlsaData *ad = data;
snd_pcm_format_t bitformat;
@@ -318,7 +318,7 @@ configure_hw:
"%u Hz\n", ad->device, audioFormat->bits,
channels, sample_rate);
- return 0;
+ return true;
error:
if (cmd) {
@@ -332,7 +332,7 @@ fail:
if (ad->pcmHandle)
snd_pcm_close(ad->pcmHandle);
ad->pcmHandle = NULL;
- return -1;
+ return false;
}
static int alsa_errorRecovery(AlsaData * ad, int err)
@@ -393,7 +393,8 @@ static void alsa_closeDevice(void *data)
}
}
-static int alsa_playAudio(void *data, const char *playChunk, size_t size)
+static bool
+alsa_playAudio(void *data, const char *playChunk, size_t size)
{
AlsaData *ad = data;
int ret;
@@ -412,7 +413,7 @@ static int alsa_playAudio(void *data, const char *playChunk, size_t size)
"error: %s\n", ad->device,
snd_strerror(-errno));
alsa_closeDevice(ad);
- return -1;
+ return false;
}
continue;
}
@@ -421,7 +422,7 @@ static int alsa_playAudio(void *data, const char *playChunk, size_t size)
size -= ret;
}
- return 0;
+ return true;
}
const struct audio_output_plugin alsaPlugin = {