aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-23 23:59:54 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-29 01:51:00 -0700
commit1fb82d55a7a1d2c378cab79b03342b8ac471ab64 (patch)
tree6c90dadd27ebb66bf7f6c03f1fa08dfd478a62c5 /src
parenta1c420d3f82da922821de8fd85bbea5eae54c3c3 (diff)
downloadmpd-1fb82d55a7a1d2c378cab79b03342b8ac471ab64.tar.gz
mpd-1fb82d55a7a1d2c378cab79b03342b8ac471ab64.tar.xz
mpd-1fb82d55a7a1d2c378cab79b03342b8ac471ab64.zip
flac: use signed integers in flac_convert_stereo16()
By mistake, I casted the sample value to uint16_t, which is wrong. This patch simplifies the code by using a int16_t pointer instead of casting to int16_t* every time.
Diffstat (limited to 'src')
-rw-r--r--src/inputPlugins/_flac_common.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c
index ddf25a0b9..3085660b3 100644
--- a/src/inputPlugins/_flac_common.c
+++ b/src/inputPlugins/_flac_common.c
@@ -204,15 +204,13 @@ static inline enum dc_action flacSendChunk(FlacData * data)
return ret;
}
-static void flac_convert_stereo16(unsigned char *dest,
+static void flac_convert_stereo16(int16_t *dest,
const FLAC__int32 * const buf[],
unsigned int position, unsigned int end)
{
for (; position < end; ++position) {
- *(uint16_t*)dest = buf[0][position];
- dest += 2;
- *(uint16_t*)dest = buf[1][position];
- dest += 2;
+ *dest++ = buf[0][position];
+ *dest++ = buf[1][position];
}
}
@@ -258,7 +256,7 @@ flac_common_write(FlacData *data, const FLAC__Frame * frame,
num_samples = max_samples;
if (num_channels == 2 && bytes_per_sample == 2)
- flac_convert_stereo16(data->chunk,
+ flac_convert_stereo16((int16_t*)data->chunk,
buf, c_samp,
c_samp + num_samples);
else