[cairo] [PATCH 2/4] scaled fonts: Use wide enough type for pointer arithmetic
psychon at znc.in
Sun Feb 21 15:05:19 UTC 2016
Am 20.02.2016 um 23:49 schrieb Adrian Johnson:
> On 12/02/16 10:19, Simon Richter wrote:
>> On 11.02.2016 21:00, Uli Schlachter wrote:
>>> Where is this cast back to a pointer that you talk about?
>> There are two instances in cairo-scaled-font.c, in lines 480 and 2827.
>> Both of them read
>> scaled_font = (cairo_scaled_font_t *) page->cache_entry.hash;
>> and the pointer is dereferenced afterwards.
>> I agree with your assessment that this should really be a hash value
>> only, and using the lower bits might work for that (although the
>> bottommost bits are probably all zero due to alignment, so it is not a
>> very good hash), but fixing that requires more changes.
> Attached is a patch to avoid storing the pointer in the hash value.
Thanks! This looks fine to me (count this as a R-b if one is needed and no one
And just for reference, apparently this was introduced in the following commit
(before it there was a cairo_scaled_glyph_page_key_t containing a
cairo_cache_entry_t and a cairo_scaled_font_t*):
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Mar 16 19:31:38 2009 +0000
[scaled-font] Lean and mean global glyph cache.
“Some people are worth melting for.” - Olaf
More information about the cairo