[cairo] float-to-string conversion vs locale

Alexander Larsson alexl at redhat.com
Sat Apr 29 03:13:29 PDT 2006


On Sat, 2006-04-29 at 05:31 -0400, Behdad Esfahbod wrote:
> On Sat, 29 Apr 2006, Alexander Larsson wrote:
> 
> > I just took a look at the float-to-string conversions in the postscript
> > backend:
> >
> > _cairo_output_stream_printf (output_stream,
> > 			 "%f %f moveto ",
> > 			 _cairo_fixed_to_double (point->x),
> > 			 _cairo_fixed_to_double (point->y));
> >
> > This is not locale-safe. In a locale with a decimal separator other than
> > "." it will not produce valid postscript. Changing the locale to "C"
> > while doing this is instead not threadsafe.
> 
> This is exactly the reason _cairo_output_stream_printf is there
> in the first place:

Oh, good! (Although I should have checked that)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's an old-fashioned zombie rock star plagued by the memory of his family's 
brutal murder. She's a cosmopolitan foul-mouthed wrestler on her way to prison 
for a murder she didn't commit. They fight crime! 



More information about the cairo mailing list