[cairo] [Bug?] Differences in error detection between a native linux-64 and a mingw (Windows) crossbuild.

Knut Petersen knupero at gmail.com
Mon Aug 2 09:33:51 UTC 2021


Hi Uli!
> Random, untested guess: One build has strtod_l() and newlocale() in libc
> and uses that. The other build uses a hand-written _cairo_strod() that
> can definitely not parse "inf".
>
> I'm not quite sure what to make about this. Perhaps it would be best to
> always use the fallback instead of the more powerful strtod_l()...?
>
> Cheers,Uli

Of course, it is not nice when errors occur on a target platform that another platform does not recognize or regards as an error.

Nevertheless, I have to admit that in the case I reported, the actual error was of course on the side of my code, "inf" is not really what you would expect as a reasonable x or y coordinate, and the error is easily avoidable.

However, implementing a cairo backend for lilypond was my first project that uses cairo, and it was very irritating for me that when using Cairo it can happen that immediately after a cairo_*() function call cairo_status() might well return CAIRO_STATUS_SUCCESS, but further processing can then 
asynchronously lead to a status != success. If you are unlucky, you will only notice an error when calling the final cairo_surface_finish(). It would have saved me some hours of debugging if there had been a corresponding hint in the documentation of cairo_status() or in 
https://www.cairographics.org/manual/cairo-Error-handling.html.

Cheers,

Knut



More information about the cairo mailing list