diff options
author | Carl Worth <cworth@cworth.org> | 2007-07-31 17:04:13 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-08-02 22:49:56 -0700 |
commit | 19b3b1fd8feb343a690331cafe88ef10b34b9d98 (patch) | |
tree | c67ab7ef05242b88aaf484a903766c9fe87aba13 /render/render.c | |
parent | 516b96387b0e57b524a37a96da22dbeeeb041712 (diff) |
Use strong hash (SHA1) for glyphs
Using a cryptographically strong hash means that comparing the
hash alone is sufficient for determining glyph equality (no need
to compare the glyph bits directly). This will allow us to replace
system-memory copies of the glyph bits, (which we've only been
holding onto for comparisons), with Pixmaps.
Diffstat (limited to 'render/render.c')
-rw-r--r-- | render/render.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/render/render.c b/render/render.c index 831c98417..c7a6dcb44 100644 --- a/render/render.c +++ b/render/render.c @@ -1080,10 +1080,10 @@ ProcRenderFreeGlyphSet (ClientPtr client) } typedef struct _GlyphNew { - Glyph id; - GlyphPtr glyph; - Bool found; - CARD32 hash; + Glyph id; + GlyphPtr glyph; + Bool found; + unsigned char sha1[20]; } GlyphNewRec, *GlyphNewPtr; static int @@ -1143,10 +1143,11 @@ ProcRenderAddGlyphs (ClientPtr client) if (remain < size) break; - glyph_new->hash = HashGlyphInfoAndBits (&gi[i], bits, size); + err = HashGlyph (&gi[i], bits, size, glyph_new->sha1); + if (err) + goto bail; - glyph_new->glyph = FindGlyphByHash (glyph_new->hash, - &gi[i], bits, + glyph_new->glyph = FindGlyphByHash (glyph_new->sha1, glyphSet->fdepth); if (glyph_new->glyph && glyph_new->glyph != DeletedGlyph) @@ -1164,6 +1165,7 @@ ProcRenderAddGlyphs (ClientPtr client) } memcpy ((CARD8 *) (glyph_new->glyph + 1), bits, size); + memcpy (glyph_new->glyph->sha1, glyph_new->sha1, 20); } glyph_new->id = gids[i]; |