Closed FGasper closed 3 years ago
#include <stdio.h> #include <ldns/ldns.h> #include <ldns/host2str.h> int main() { const char* rrtxt = "foo 12345 IN LOC 12 45 52.333 N 105 40 33.452 W -24m 0.1m 0.1m 0.1m"; ldns_rr* myrr = NULL; ldns_rr_new_frm_str(&myrr, rrtxt, 999, NULL, NULL); printf("%s", ldns_rr2str(myrr)); ldns_rr_free(myrr); return 0; }
^^ This outputs:
foo. 12345 IN LOC 12 45 52.333 N 105 40 33.452 W -24m 0.01m 0.01m 0.01m
Note that the last few values are 0.01m, not 0.1m.
The reason is that loc_parse_cm does this:
loc_parse_cm
if (*my_str == '.') { my_str++; cm = (uint32_t)strtol(my_str, &my_str, 10); }
It needs to multiply cm by 10 if only 1 digit is given.
cm
Fix is merged
^^ This outputs:
Note that the last few values are 0.01m, not 0.1m.
The reason is that
loc_parse_cm
does this:It needs to multiply
cm
by 10 if only 1 digit is given.