Skip to content

Why does the PNG surface's write_func (and cairo_write_func_t) use mutable data? #1771

@inklesspen

Description

@inklesspen

pub type cairo_write_func_t =
Option<unsafe extern "C" fn(*mut c_void, *mut c_uchar, c_uint) -> cairo_status_t>;

unsafe extern "C" fn write_func<W: Write>(
closure: *mut c_void,
data: *mut u8,
len: c_uint,
) -> crate::ffi::cairo_status_t {

The corresponding C type takes a const unsigned char *data.

My guess is this was a copy-paste error when adding both read_func and write_func, since read_func does need to take a mutable char pointer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions