rpms/cairo/devel cairo-0.9.2-dont-hash-null-string.patch,NONE,1.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Aug 19 20:41:43 UTC 2005


Author: krh

Update of /cvs/dist/rpms/cairo/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19626

Added Files:
	cairo-0.9.2-dont-hash-null-string.patch 
Log Message:
Actually add patch.

cairo-0.9.2-dont-hash-null-string.patch:
 cairo-cache.c   |    2 +-
 cairo-ft-font.c |   32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

--- NEW FILE cairo-0.9.2-dont-hash-null-string.patch ---
# HG changeset patch
# User cworth
# Date Wed Aug 17 20:51:09 2005
# Node ID 501a0894e04ea2736adef653f18fafe97a56532c
# parent: bef9af9a26fc9460da28d7673fcc60c1f8bb8edb
cairo: changeset 2005-08-17 16:51:09 by cworth

- 2005-08-17 Carl Worth <cworth at cworth.org> Fixes for bug #4110:

- src/cairo-ft-font.c (_cairo_ft_unscaled_font_init): Don't call
  _cairo_ft_unscaled_font_init_key in the from_face case, just clear
  filename and id instead. Initialize unscaled->base first so that
  initialization order matches the structure declaration order.

- src/cairo-cache.c (_cairo_hash_string): Fix to accept a NULL string
  and hash it identically to a zero-length string.

- test/Makefile.am:

- test/ft-font-create-for-ft-face: Add a test that calls
  cairo_ft_font_create_for_ft_face to demonstrate bug #4110.

--- a/src/cairo-cache.c	Wed Aug 17 08:04:02 2005
+++ b/src/cairo-cache.c	Wed Aug 17 20:51:09 2005
@@ -512,7 +512,7 @@
 {
     /* This is the djb2 hash. */
     unsigned long hash = 5381;
-    while (*c)
+    while (c && *c)
 	hash = ((hash << 5) + hash) + *c++;
     return hash;
 }
--- a/src/cairo-ft-font.c	Wed Aug 17 08:04:02 2005
+++ b/src/cairo-ft-font.c	Wed Aug 17 20:51:09 2005
@@ -290,31 +290,31 @@
 			      int			id,
 			      FT_Face			face)
 {
-    char *filename_copy = NULL;
-
-    if (filename) {
+    _cairo_unscaled_font_init (&unscaled->base,
+			       &cairo_ft_unscaled_font_backend);
+
+    if (face) {
+	unscaled->from_face = TRUE;
+	unscaled->face = face;
+	unscaled->filename = NULL;
+	unscaled->id = 0;
+    } else {
+	char *filename_copy;
+
+	unscaled->from_face = FALSE;
+	unscaled->face = NULL;
+
 	filename_copy = strdup (filename);
 	if (filename_copy == NULL)
 	    return CAIRO_STATUS_NO_MEMORY;
-    }
-
-    _cairo_ft_unscaled_font_init_key (unscaled, filename_copy, id);
-
-    if (face) {
-	unscaled->from_face = 1;
-	unscaled->face = face;
-    } else {
-	unscaled->from_face = 0;
-	unscaled->face = NULL;
+
+	_cairo_ft_unscaled_font_init_key (unscaled, filename_copy, id);
     }
 
     unscaled->have_scale = 0;
     unscaled->lock = 0;
     
     unscaled->faces = NULL;
-
-    _cairo_unscaled_font_init (&unscaled->base,
-			       &cairo_ft_unscaled_font_backend);
 
     return CAIRO_STATUS_SUCCESS;
 }




More information about the fedora-cvs-commits mailing list