[cairo] fflush in copy_page

TOKUNAGA Hiroyuki tkng at xem.jp
Thu Sep 16 03:49:51 PDT 2004


Hi folks,

Now I'm creating a new language binding for cairo and encounting a
problem. The binding is for Gauche, a scheme interpreter.

The problem is that, some functions such as cairo_png_surface_create
receive a file pointer as its arguments, and file pointer has a
buffering feature.

Scheme cannot handle file pointer, so I have to create file pointer from
a file descriptor (to be exactly, not from a file descriptor but from a
port) by fdopen in my binding.

When a user calls closing function to close the file descriptor, the
problem occurs. We don't have a reference to file pointer in the
binding, this means the user has no way to flush the file pointer before
close. This cause a data loss buffered by FILE.

Of course, solving this problem in binding side is not impossible, but
will be ugly. If fflush is called in the last of cairo_copy_page
function, the problem doesn't occur.

With attached patch, cairo calls fflush in _cairo_png_surface_copy_page
and _cairo_ps_surface_copy_page.

I'm happy if you apply this patch.


Regards,

-- 
TOKUNAGA Hiroyuki
tkng at xem.jp
http://kodou.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo_surface_fflush.patch
Type: application/octet-stream
Size: 951 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040916/c437ef4f/cairo_surface_fflush.obj


More information about the cairo mailing list