Re: [PATCH 2/4] scaled fonts: Use wide enough type for pointer arithmetic

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Am 20.02.2016 um 23:49 schrieb Adrian Johnson:
> On 12/02/16 10:19, Simon Richter wrote:
>> Hi,
>>
>> 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.
>>
>>    Simon
> 
> 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
else dares).

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*):

  commit 9c80392ac415e7f07c71261d280ac4376d3c8471
  Author: Chris Wilson <[email protected]>
  Date:   Mon Mar 16 19:31:38 2009 +0000

      [scaled-font] Lean and mean global glyph cache.

Cheers,
Uli
-- 
“Some people are worth melting for.” - Olaf
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.