[cairo] pdf problem on windows

Tor Lillqvist tml at iki.fi
Fri Feb 22 15:58:41 PST 2008

> Looking at your attached pdf, every long number in cairo-pdf-surface.c
>  that is printed with %ld is being treated as a 64-bit number. However
>  the bogus values indicate that long is a 32-bit integer.
>  It looks like cairo was compiled as a 32-bit binary while the dll
>  containing printf is assuming 64-bit.

What cairo version is this with? Looking in the 1.4.10
cairo-pdf-surface.c, all the printing using %ld format goes through
cairo's own _cairo_output_stream_printf(), which uses va_arg() to get
a "long int" (which is 32 bits on Windows), and passes the %ld format
and the long int on to _snprintf() which is in the Microsoft C runtime
and this should work just fine. No 64-bit integers are involved as far
as I can see.

(If 64-bit integers were involved, then some care would be needed. In
the Microsoft C runtime the formats for 64-bit integers use the
somewhat unique "I64" indicator (and not the "ll" typically used on
Unixes), for example %I64d for decimal formatting of 64-bit integers.
This is regardless if one compiles with gcc or MSVC, as the C library
is the same for both. However, the type for 64-bit integers is called
"long long" in gcc, and "__int64" in MSVC.)


More information about the cairo mailing list