From 54c591bd9d9657065fb1c338eefe416840c78d3e Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Tue, 28 Oct 2014 22:22:30 +0100
Subject: decoder/mad: fix negative replay gain values

Negating an unsigned integer does not work.
---
 src/decoder/plugins/MadDecoderPlugin.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/decoder/plugins')

diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index 41efb593d..de6c9b127 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -657,7 +657,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen)
 	unsigned name = mad_bit_read(ptr, 3); /* gain name */
 	unsigned orig = mad_bit_read(ptr, 3); /* gain originator */
 	unsigned sign = mad_bit_read(ptr, 1); /* sign bit */
-	unsigned gain = mad_bit_read(ptr, 9); /* gain*10 */
+	int gain = mad_bit_read(ptr, 9); /* gain*10 */
 	if (gain && name == 1 && orig != 0) {
 		lame->track_gain = ((sign ? -gain : gain) / 10.0) + adj;
 		FormatDebug(mad_domain, "LAME track gain found: %f",
-- 
cgit v1.2.3