aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/audiofile_plugin.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/inputPlugins/audiofile_plugin.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/inputPlugins/audiofile_plugin.c')
-rw-r--r--src/inputPlugins/audiofile_plugin.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c
index 1213d31e5..3ca9a14c3 100644
--- a/src/inputPlugins/audiofile_plugin.c
+++ b/src/inputPlugins/audiofile_plugin.c
@@ -67,9 +67,9 @@ static int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
afSetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK,
AF_SAMPFMT_TWOSCOMP, 16);
afGetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits);
- dc->audioFormat.bits = bits;
- dc->audioFormat.sampleRate = afGetRate(af_fp, AF_DEFAULT_TRACK);
- dc->audioFormat.channels = afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK);
+ dc->audioFormat.bits = (mpd_uint8)bits;
+ dc->audioFormat.sampleRate = (unsigned int)afGetRate(af_fp, AF_DEFAULT_TRACK);
+ dc->audioFormat.channels = (mpd_uint8)afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK);
getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat));
frame_count = afGetFrameCount(af_fp, AF_DEFAULT_TRACK);
@@ -77,7 +77,7 @@ static int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
dc->totalTime =
((float)frame_count / (float)dc->audioFormat.sampleRate);
- bitRate = st.st_size * 8.0 / dc->totalTime / 1000.0 + 0.5;
+ bitRate = (mpd_uint16)(st.st_size * 8.0 / dc->totalTime / 1000.0 + 0.5);
if (dc->audioFormat.bits != 8 && dc->audioFormat.bits != 16) {
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",