[cairo] Warnings on Win32

Bobby Salazar bobby8934 at inbox.com
Wed Mar 12 15:41:05 PDT 2008


In an effort to get Cairo to compile with no warnings, here is some information about current (useless) warnings.

In cairoint.h there is this function:

static inline uint32_t
cpu_to_be32(uint32_t v)
{
    return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
}

That function causes this warning about 102 times when I compile Cairo under MSVC++ 6.0:
warning C4244: 'function' : conversion from 'unsigned __int32 ' to 'unsigned __int16 ', possible loss of data

This change will fix the warning:

static inline uint32_t
cpu_to_be32(uint32_t v)
{
    return (v << 16) | (v >> 16);
}


Anyone care to commit it?


Also, in case anyone cares, here are the other 78 warnings I get on MSVC++ 6.0 (after fixing the function above):

Compiling...
cairo-analysis-surface.c
cairo-arc.c
cairo-array.c
cairo-base85-stream.c
cairo-bentley-ottmann.c
cairo\src\cairo-bentley-ottmann.c(549) : warning C4244: '=' : conversion from '__int64 ' to '__int32 ', possible loss of data
cairo\src\cairo-bentley-ottmann.c(558) : warning C4244: '=' : conversion from '__int64 ' to '__int32 ', possible loss of data
cairo\src\cairo-bentley-ottmann.c(1428) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-bentley-ottmann.c(1429) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo-cache.c
cairo-clip.c
cairo-color.c
cairo\src\cairo-color.c(104) : warning C4244: 'return' : conversion from 'unsigned __int32 ' to 'unsigned __int16 ', possible loss of data
cairo-debug.c
cairo-fixed.c
cairo-font-options.c
cairo-font.c
cairo-freelist.c
cairo-ft-font.c
cairo\src\cairo-ft-font.c(662) : warning C4244: 'function' : conversion from 'double ' to 'long ', possible loss of data
cairo\src\cairo-ft-font.c(663) : warning C4244: 'function' : conversion from 'double ' to 'long ', possible loss of data
cairo\src\cairo-ft-font.c(777) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
cairo\src\cairo-ft-font.c(1151) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1151) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1152) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1152) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1156) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1158) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1160) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1162) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-ft-font.c(1731) : warning C4244: '=' : conversion from 'double ' to '__int32 ', possible loss of data
cairo\src\cairo-ft-font.c(1732) : warning C4244: '=' : conversion from 'double ' to '__int32 ', possible loss of data
cairo\src\cairo-ft-font.c(1734) : warning C4244: '=' : conversion from 'double ' to '__int32 ', possible loss of data
cairo\src\cairo-ft-font.c(1735) : warning C4244: '=' : conversion from 'double ' to '__int32 ', possible loss of data
cairo\src\cairo-ft-font.c(2100) : warning C4101: 'face' : unreferenced local variable
cairo-gstate.c
cairo-hash.c
cairo-hull.c
cairo-image-surface.c
cairo-lzw.c
cairo\src\cairo-lzw.c(139) : warning C4244: '=' : conversion from 'unsigned __int32 ' to 'unsigned char ', possible loss of data
cairo\src\cairo-lzw.c(170) : warning C4244: '=' : conversion from 'unsigned __int32 ' to 'unsigned char ', possible loss of data
cairo-matrix.c
Generating Code...
cairo\src\cairo-lzw.c(365) : warning C4761: integral size mismatch in argument; conversion supplied
cairo\src\cairo-ft-font.c(664) : warning C4761: integral size mismatch in argument; conversion supplied
cairo\src\cairo-ft-font.c(664) : warning C4761: integral size mismatch in argument; conversion supplied
Compiling...
cairo-meta-surface.c
cairo-operator.c
cairo-output-stream.c
cairo-paginated-surface.c
cairo\src\cairo-paginated-surface.c(242) : warning C4244: 'function' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-paginated-surface.c(243) : warning C4244: 'function' : conversion from 'double ' to 'int ', possible loss of data
cairo-path-bounds.c
cairo-path-fill.c
cairo-path-fixed.c
cairo-path-stroke.c
cairo-path.c
cairo-pattern.c
cairo\src\cairo-pattern.c(1624) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-pattern.c(1625) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-pattern.c(1626) : warning C4244: '=' : conversion from 'double ' to 'unsigned int ', possible loss of data
cairo\src\cairo-pattern.c(1627) : warning C4244: '=' : conversion from 'double ' to 'unsigned int ', possible loss of data
cairo\src\cairo-pattern.c(1950) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-pattern.c(1950) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-pattern.c(1951) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-pattern.c(1951) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo-pen.c
cairo\src\cairo-pen.c(269) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
cairo-polygon.c
cairo-rectangle.c
cairo-region.c
cairo-scaled-font-subsets.c
cairo-scaled-font.c
cairo\src\cairo-scaled-font.c(1285) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
cairo\src\cairo-scaled-font.c(1289) : warning C4244: 'function' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-scaled-font.c(1289) : warning C4244: 'function' : conversion from 'double ' to 'int ', possible loss of data
cairo-skiplist.c
cairo-slope.c
cairo-spline.c
cairo\src\cairo-spline.c(228) : warning C4244: '=' : conversion from 'double ' to '__int32 ', possible loss of data
cairo\src\cairo-spline.c(229) : warning C4244: '=' : conversion from 'double ' to '__int32 ', possible loss of data
cairo-stroke-style.c
Generating Code...
cairo\src\cairo-scaled-font.c(1289) : warning C4761: integral size mismatch in argument; conversion supplied
cairo\src\cairo-scaled-font.c(1289) : warning C4761: integral size mismatch in argument; conversion supplied
cairo\src\cairo-paginated-surface.c(243) : warning C4761: integral size mismatch in argument; conversion supplied
cairo\src\cairo-paginated-surface.c(243) : warning C4761: integral size mismatch in argument; conversion supplied
Compiling...
cairo-surface-fallback.c
cairo-surface.c
cairo\src\cairo-surface.c(718) : warning C4244: 'function' : conversion from 'double ' to 'int ', possible loss of data
cairo\src\cairo-surface.c(719) : warning C4244: 'function' : conversion from 'double ' to 'int ', possible loss of data
cairo-traps.c
cairo-unicode.c
cairo\src\cairo-unicode.c(319) : warning C4244: '=' : conversion from 'unsigned __int32 ' to 'unsigned __int16 ', possible loss of data
cairo\src\cairo-unicode.c(321) : warning C4244: '=' : conversion from 'unsigned __int32 ' to 'unsigned __int16 ', possible loss of data
cairo\src\cairo-unicode.c(322) : warning C4244: '=' : conversion from 'unsigned __int32 ' to 'unsigned __int16 ', possible loss of data
cairo-wideint.c
cairo\src\cairo-wideint.c(308) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-wideint.c(312) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-wideint.c(451) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned __int32 ', possible loss of data
cairo\src\cairo-wideint.c(452) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned __int32 ', possible loss of data
cairo\src\cairo-wideint.c(453) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned __int32 ', possible loss of data
cairo\src\cairo-wideint.c(454) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned __int32 ', possible loss of data
cairo\src\cairo-wideint.c(682) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-wideint.c(682) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-wideint.c(704) : warning C4244: 'initializing' : conversion from 'unsigned __int64 ' to 'unsigned __int32 ', possible loss of data
cairo\src\cairo-wideint.c(741) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned __int32 ', possible loss of data
cairo\src\cairo-wideint.c(749) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-wideint.c(798) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-wideint.c(804) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo\src\cairo-wideint.c(808) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
cairo-win32-font.c
cairo\src\cairo-win32-font.c(307) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
cairo\src\cairo-win32-font.c(308) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
cairo\src\cairo-win32-font.c(309) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
cairo\src\cairo-win32-font.c(310) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
cairo\src\cairo-win32-font.c(311) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
cairo\src\cairo-win32-font.c(312) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
cairo\src\cairo-win32-font.c(356) : warning C4244: '=' : conversion from 'double ' to 'long ', possible loss of data
cairo\src\cairo-win32-font.c(590) : warning C4244: '=' : conversion from 'double ' to 'unsigned int ', possible loss of data
cairo\src\cairo-win32-font.c(640) : warning C4244: '*=' : conversion from 'const double ' to 'unsigned int ', possible loss of data
cairo\src\cairo-win32-font.c(963) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
cairo\src\cairo-win32-font.c(1104) : warning C4244: '=' : conversion from 'unsigned __int32 ' to 'unsigned char ', possible loss of data
cairo-win32-surface.c
cairo.c
test-fallback-surface.c
test-meta-surface.c
test-paginated-surface.c
Generating Code...
cairo\src\cairo-surface.c(720) : warning C4761: integral size mismatch in argument; conversion supplied
cairo\src\cairo-surface.c(720) : warning C4761: integral size mismatch in argument; conversion supplied
Creating library...

cairo.lib - 0 error(s), 78 warning(s)

____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails


More information about the cairo mailing list