[cairo] Re: [cairo-commit] 2 commits - src/cairo-pattern.c
src/cairo-ps-surface.c
Behdad Esfahbod
behdad at behdad.org
Fri Mar 2 09:44:14 PST 2007
On Fri, 2007-03-02 at 03:37 -0500, Carl Worth wrote:
>
> @@ -1351,7 +1351,12 @@ surface_pattern_supported (const cairo_s
> return FALSE;
> */
>
> - extend = cairo_pattern_get_extend (&pattern->base);
> + /* Cast away the const, trusting get_extend not to muck with it.
> + * And I really wish I had a way to cast away just the const, and
> + * not potentially coerce this pointer to an incorrect type at
> the
> + * same time. :-(
> + */
> + extend = cairo_pattern_get_extend
> ((cairo_pattern_t*)&pattern->base);
> switch (extend) {
The correct fix is IMO to make surface_pattern_supported argument
non-const. We don't use const for most cairo types because they are
opaque and const does not make much sense in the public API. It sure
makes sense internally, but these kind of problems appear.
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo
mailing list