oma-lwm2m: Handle text/plain floatfix numbers without decimal point

Fixes bug: If no decimal point is present then the entire number is
treated as the decimal part instead of the integer part
This commit is contained in:
Joakim Nohlgård 2016-05-19 09:46:51 +02:00
parent c5bea81bb6
commit 99c77bda8c

View file

@ -100,6 +100,11 @@ lwm2m_plain_text_read_float32fix(const uint8_t *inbuf, size_t len,
break;
}
}
if(dot == 0) {
integerpart = counter;
counter = 0;
frac = 1;
}
*value = integerpart << bits;
if(frac > 1) {
*value += ((counter << bits) / frac);