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>
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)