diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-09-06 19:44:39 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-09-06 19:44:39 +0000 |
commit | 9401e5643e90e23287b785e5fc238bb7c7f2d896 (patch) | |
tree | 759a23118c7bb4a1cddc87b3ad5c63f459a64bd2 /xserver/render/glyph.c | |
parent | 6d29d2deb77299e537a0daf2babf0e217ce51376 (diff) |
update to xserver 1.6.4rc1. Tested by many, ok oga@.
Diffstat (limited to 'xserver/render/glyph.c')
-rw-r--r-- | xserver/render/glyph.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/xserver/render/glyph.c b/xserver/render/glyph.c index 286e39d63..1fd36ef02 100644 --- a/xserver/render/glyph.c +++ b/xserver/render/glyph.c @@ -26,8 +26,14 @@ #include <dix-config.h> #endif -#include <stddef.h> /* buggy openssl/sha.h wants size_t */ -#include <openssl/sha.h> +#if defined(HAVE_SHA1INIT) || /* Use libc SHA1 */ \ + defined(HAVE_SHA1_IN_LIBMD) /* Use libmd for SHA1 */ +# include <sys/types.h> +# include <sha1.h> +#else /* Use OpenSSL's libcrypto */ +# include <stddef.h> /* buggy openssl/sha.h wants size_t */ +# include <openssl/sha.h> +#endif #include "misc.h" #include "scrnintstr.h" @@ -88,14 +94,6 @@ static GlyphHashRec globalGlyphs[GlyphFormatNum]; static void FreeGlyphPrivates (GlyphPtr glyph) { - ScreenPtr pScreen; - int i; - - for (i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - dixFreePrivates(*GetGlyphPrivatesForScreen(glyph, pScreen)); - } - dixFreePrivates(glyph->devPrivates); glyph->devPrivates = NULL; } @@ -202,6 +200,15 @@ HashGlyph (xGlyphInfo *gi, unsigned long size, unsigned char sha1[20]) { +#if defined(HAVE_SHA1INIT) || /* SHA1 in libC */ \ + defined(HAVE_SHA1_IN_LIBMD) /* Use libmd for SHA1 */ + SHA1_CTX ctx; + + SHA1Init (&ctx); + SHA1Update (&ctx, gi, sizeof (xGlyphInfo)); + SHA1Update (&ctx, bits, size); + SHA1Final (sha1, &ctx); +#else /* Use OpenSSL's libcrypto */ SHA_CTX ctx; int success; @@ -220,6 +227,7 @@ HashGlyph (xGlyphInfo *gi, success = SHA1_Final (sha1, &ctx); if (! success) return BadAlloc; +#endif return Success; } @@ -436,10 +444,9 @@ bail: Bool AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet) { - hash->table = (GlyphRefPtr) xalloc (hashSet->size * sizeof (GlyphRefRec)); + hash->table = xcalloc (hashSet->size, sizeof (GlyphRefRec)); if (!hash->table) return FALSE; - memset (hash->table, 0, hashSet->size * sizeof (GlyphRefRec)); hash->hashSet = hashSet; hash->tableEntries = 0; return TRUE; @@ -508,10 +515,9 @@ AllocateGlyphSet (int fdepth, PictFormatPtr format) } size = sizeof (GlyphSetRec); - glyphSet = xalloc (size); + glyphSet = xcalloc (1, size); if (!glyphSet) return FALSE; - bzero((char *)glyphSet, size); if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0])) { |