Problem with strtod() in parse_number()
Hi,
I am currently using source file cJSON.c for an embedded system that uses an old version of uClibc. The strtod() function is broken and I am unable to parse numbers. Would it be possible to reintroduce the old number parsing functionality before v1.3.0 that did not use strtod? Originally I did not have any issues when using the older version of cJSON, but this will not be possible to use on my current system. Another work around that I can think of is to use an strtod hook.
Best Regards Justin
To bypass this issue you can overwrite this function with your own.
We are having the same issue. parse_number is a core function in cJSON, so I think it makes sense for it to be fixed in the library. It doesn't work on some CPU platforms. parse_number initially parses all numbers in the double realm, then casts it to the valueint. I think parse_number should parse integers as integers into valueint, and doubles as doubles parsed into valuedouble. When done, it can cast one to the other. I think that would get the best result.
For our work around, we also reverted to a much older version of cJSON.