aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-23 23:59:54 +0200
committerMax Kellermann <max@duempel.org>2008-09-23 23:59:54 +0200
commit7486c1508898d1dd135effd3c7430552583a7737 (patch)
tree70fc83ead2b69ac5687c8b9cf29b0c533921fe90
parent8bcbe90b250e651fa499524a8c677e19198427a7 (diff)
downloadmpd-7486c1508898d1dd135effd3c7430552583a7737.tar.gz
mpd-7486c1508898d1dd135effd3c7430552583a7737.tar.xz
mpd-7486c1508898d1dd135effd3c7430552583a7737.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 '')
-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 5a98e63bc..427956c39 100644
--- a/src/inputPlugins/_flac_common.c
+++ b/src/inputPlugins/_flac_common.c
@@ -209,15 +209,13 @@ static inline int flacSendChunk(FlacData * data)
return 0;
}
-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];
}
}
@@ -264,7 +262,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