Bug 41185

Summary: lround func call missing definition under MSVC leads to always zero returns
Product: cairo Reporter: fmot.fics
Component: win32 backendAssignee: cairo-bugs mailing list <cairo-bugs>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.10.2   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description fmot.fics 2011-09-25 08:20:23 UTC
There is a piece of code in cairoint.h:
#if DISABLE_SOME_FLOATING_POINT
cairo_private int
_cairo_lround (double d) cairo_const;
#else
#define _cairo_lround lround
#endif

This code works well if lround defitionion was met before. However if cairo is compiler using MSVC there is no lround definition.
And argument is passed as int. Return from lround is thus unpredictable, but most probably zero.

I'd suggest a simple following workaround:
#if DISABLE_SOME_FLOATING_POINT
cairo_private int
_cairo_lround (double d) cairo_const;
#else
#ifdef _MSC_VER
long int lround(double x);
#endif
#define _cairo_lround lround
#endif

The bug is difficult to find. The code compiles well, does not crash but text is not printed.
Comment 1 GitLab Migration User 2018-08-25 13:42:47 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/155.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.