amixer: fix print_dB for -0.99 .. -0.01 range

The first number is 0 when input dB (hundreds) is in range -99 .. -1 .
The printed number was positive in this case. This patch fixes this issue.

Reported-by: Tom Becker <GTBecker@RighTime.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2013-05-28 08:43:30 +02:00
parent d61924fd24
commit c80a38dbf5

View file

@ -431,7 +431,11 @@ static void print_spaces(unsigned int spaces)
static void print_dB(long dB)
{
printf("%li.%02lidB", dB / 100, (dB < 0 ? -dB : dB) % 100);
if (dB < 0) {
printf("-%li.%02lidB", -dB / 100, -dB % 100);
} else {
printf("%li.%02lidB", dB / 100, dB % 100);
}
}
static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_size)