Issue with strtod() on non c99 compliant platforms
Peter Kümmel
syntheticpp at gmx.net
Wed Aug 30 23:04:48 PDT 2006
Peter Kümmel wrote:
> Christian Ehrlicher wrote:
>> Hello,
>>
>> dbus-test breaks on win32 due to the lack of a c99 implementation of strtod(). In one of the tests a hex digit is converted to a double which is only valid for c99 and above (dbus-sysdeps-util.c:~145).
>> Since this is (imho) not a windows-only problem, you either should rewrite the test or add a check for a valid c99 environment and provide a correct strtod - implementation if it fails.
>>
>> Christian
>
> Earlier there was a comment from Havoc:
>
> my patch:
>> +#ifndef DBUS_WIN
>> _dbus_string_init_const (&str, "0xff");
>> if (!_dbus_string_parse_double (&str,
>> 0, &val, &pos))
>> @@ -848,12 +1174,23 @@
>> _dbus_warn ("_dbus_string_parse_double of \"0xff\" returned wrong position %d", pos);
>> exit (1);
>> }
>> +#endif
>
>
> <Havoc> This doesn't look like it should be #ifndef DBUS_WIN,
> <Havoc> at least not without a comment or @todo or FIXME.
> <Havoc>
> <Havoc> Something I suggested earlier was using a DBUS_WIN_FIXME or DBUS_WIN_TEMPORARY
> <Havoc> or something to bracket temporarily-disabled stuff, vs. stuff that's more long term.
> @@ -1339,6 +1495,10 @@
> ascii_strtod (const char *nptr,
> char **endptr)
> {
> + /* FIXME: The Win32 C library's strtod() doesn't handle hex.
> + * Presumably many Unixes don't either.
> + */
> +
<Havoc> Should be able to try strtol() also or something like that.
More information about the dbus
mailing list