[Poppler-bugs] [Bug 23031] New: patch for Gfx.cc compile warning converting to 'int' from 'double'

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jul 29 19:09:58 PDT 2009


http://bugs.freedesktop.org/show_bug.cgi?id=23031

           Summary: patch for Gfx.cc compile warning converting to 'int'
                    from 'double'
           Product: poppler
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
        AssignedTo: poppler-bugs at lists.freedesktop.org
        ReportedBy: williambader at hotmail.com
                CC: williambader at hotmail.com


Created an attachment (id=28179)
 --> (http://bugs.freedesktop.org/attachment.cgi?id=28179)
the patch

Gfx.cc has three places where it assigns a double expression to an int
variable.  gcc complains with
Gfx.cc: In member function 'void Gfx::doAxialShFill(GfxAxialShading*)':
Gfx.cc:2515: warning: converting to 'int' from 'double'
Gfx.cc:2529: warning: converting to 'int' from 'double'
Gfx.cc: In member function 'void Gfx::doImage(Object*, Stream*, GBool)':
Gfx.cc:3964: warning: converting to 'int' from 'double'
This code is a little risky because on some systems, assigning a double outside
the range of INT_MIN .. INT_MAX to an int can cause a core dump.
I added an (int) cast to make gcc quiet.
To be safer, maybe teoricalj should be changed from int to double and the test
should be
  if (floor(teoricalj) <= (double)i) ...


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


More information about the Poppler-bugs mailing list