mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 13:26:32 +01:00
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:
parent
d61924fd24
commit
c80a38dbf5
1 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue