On Thu, Oct 8, 2009 at 5:47 PM, Ian Romanick <i...@freedesktop.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> The root cause of bug #23308 has been determined to be the use of strtod
> in our assembly and GLSL parsers.  When LANG is set to a locale that
> changes the radix from "." to, say, ",", floating point numbers are not
> parsed correctly.
>
> It seems that the correct fix is to have _mesa_strtod actually implement
> strtod and ignore the locale setting.  I considered writing my own, but
> low-level floating point processing is one of those tricks best left to
> experts.  I've searched the net, and found an implementation.  It is
> extremely complex, and the code is quite archaic.
>
> What I found is David Gay's dtoa.c (http://www.netlib.org/fp/dtoa.c).
> Should I use this, or does anyone know of a better implementation?

GNU libc has strtod_l, which takes a locale_t as its last argument.
Use newlocale() to create a locale_t to pass to strtod_l and
freelocale() to free it.  We could create the locale up front and
store it in the context or probably even just as a global variable.
That doesn't solve the problem for non-glibc platforms, of course, but
pulling in a appropriately licensed strtod in that case is not a big
problem.

cheers,
Kristian

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to