[cairo-bugs] [Bug 41185] New: lround func call missing definition under MSVC leads to always zero returns

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Sep 25 08:20:26 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=41185

           Summary: lround func call missing definition under MSVC leads
                    to always zero returns
           Product: cairo
           Version: 1.10.2
          Platform: x86 (IA32)
        OS/Version: Windows (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: win32 backend
        AssignedTo: cairo-bugs at cairographics.org
        ReportedBy: fmot.fics at gmail.com
         QAContact: cairo-bugs at cairographics.org


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.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the cairo-bugs mailing list