aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-03-26 10:37:17 +0000
committerEric Wong <normalperson@yhbt.net>2008-03-26 10:37:17 +0000
commit66fe58064295f838f894758d92b087100ce022aa (patch)
treeb0f967f7e55bccb9d1390c23c0333d047384eaf3 /src/audio.c
parent13c17c3d942f1074d76caeaf39ebe0d5017593e9 (diff)
downloadmpd-66fe58064295f838f894758d92b087100ce022aa.tar.gz
mpd-66fe58064295f838f894758d92b087100ce022aa.tar.xz
mpd-66fe58064295f838f894758d92b087100ce022aa.zip
explicitly downcast
Tools like "sparse" check for missing downcasts, since implicit cast may be dangerous. Although that does not change the compiler result, it may make the code more readable (IMHO), because you always see when there may be data cut off. git-svn-id: https://svn.musicpd.org/mpd/trunk@7196 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/audio.c b/src/audio.c
index 145e6be3c..b0c731639 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -197,7 +197,7 @@ int parseAudioConfig(AudioFormat * audioFormat, char *conf)
return -1;
}
- audioFormat->bits = strtol(test + 1, &test, 10);
+ audioFormat->bits = (mpd_sint8)strtol(test + 1, &test, 10);
if (*test != ':') {
ERROR("error parsing audio output format: %s\n", conf);
@@ -213,7 +213,7 @@ int parseAudioConfig(AudioFormat * audioFormat, char *conf)
return -1;
}
- audioFormat->channels = strtol(test + 1, &test, 10);
+ audioFormat->channels = (mpd_sint8)strtol(test + 1, &test, 10);
if (*test != '\0') {
ERROR("error parsing audio output format: %s\n", conf);
@@ -428,7 +428,7 @@ void sendMetadataToAudioDevice(MpdTag * tag)
int enableAudioDevice(int fd, int device)
{
- if (device < 0 || device >= audioOutputArraySize) {
+ if (device >= audioOutputArraySize) {
commandError(fd, ACK_ERROR_ARG, "audio output device id %i "
"doesn't exist\n", device);
return -1;
@@ -442,7 +442,7 @@ int enableAudioDevice(int fd, int device)
int disableAudioDevice(int fd, int device)
{
- if (device < 0 || device >= audioOutputArraySize) {
+ if (device >= audioOutputArraySize) {
commandError(fd, ACK_ERROR_ARG, "audio output device id %i "
"doesn't exist\n", device);
return -1;