[cairo-commit] cairo/src cairo-array.c, 1.10, 1.11 cairo-meta-surface.c, 1.22, 1.23 cairo-win32-font.c, 1.46, 1.47 cairoint.h, 1.238, 1.239

Carl Worth commit at pdx.freedesktop.org
Wed Dec 21 12:20:09 PST 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv16029/src

Modified Files:
	cairo-array.c cairo-meta-surface.c cairo-win32-font.c 
	cairoint.h 
Log Message:

2005-12-21  Carl Worth  <cworth at cworth.org>

        * src/cairoint.h:
        * src/cairo-array.c: (_cairo_array_fini), (_cairo_array_grow_by),
        (_cairo_array_index), (_cairo_array_allocate),
        (_cairo_user_data_array_fini), (_cairo_user_data_array_get_data),
        (_cairo_user_data_array_set_data):
        * src/cairo-meta-surface.c: (_cairo_meta_surface_finish),
        (_cairo_meta_surface_replay):
        * src/cairo-win32-font.c: (_flush_glyphs):

        Revert inadvertent commit (immediately previous).


Index: cairo-array.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-array.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cairo-array.c	21 Dec 2005 20:08:57 -0000	1.10
+++ cairo-array.c	21 Dec 2005 20:20:06 -0000	1.11
@@ -96,10 +96,7 @@
     if (array->is_snapshot)
 	return;
 
-    if (array->elements) {
-	free (* array->elements);
-	free (array->elements);
-    }
+    free (array->elements);
 }
 
 /**
@@ -130,15 +127,8 @@
     while (new_size < required_size)
 	new_size = new_size * 2;
 
-    if (array->elements == NULL) {
-	array->elements = malloc (sizeof (char *));
-	if (array->elements == NULL)
-	    return CAIRO_STATUS_NO_MEMORY;
-	*array->elements = NULL;
-    }
-
     array->size = new_size;
-    new_elements = realloc (*array->elements,
+    new_elements = realloc (array->elements,
 			    array->size * array->element_size);
 
     if (new_elements == NULL) {
@@ -146,7 +136,7 @@
 	return CAIRO_STATUS_NO_MEMORY;
     }
 
-    *array->elements = new_elements;
+    array->elements = new_elements;
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -191,7 +181,7 @@
 {
     assert (0 <= index && index < array->num_elements);
 
-    return (void *) &(*array->elements)[index * array->element_size];
+    return (void *) &array->elements[index * array->element_size];
 }
 
 /**
@@ -286,7 +276,7 @@
 
     assert (array->num_elements + num_elements <= array->size);
 
-    *elements = &(*array->elements)[array->num_elements * array->element_size];
+    *elements = &array->elements[array->num_elements * array->element_size];
 
     array->num_elements += num_elements;
 
@@ -341,10 +331,7 @@
     cairo_user_data_slot_t *slots;
 
     num_slots = array->num_elements;
-    if (num_slots == 0)
-	return;
-
-    slots = (cairo_user_data_slot_t *) (*array->elements);
+    slots = (cairo_user_data_slot_t *) array->elements;
     for (i = 0; i < num_slots; i++) {
 	if (slots[i].user_data != NULL && slots[i].destroy != NULL)
 	    slots[i].destroy (slots[i].user_data);
@@ -378,10 +365,7 @@
 	return NULL;
 
     num_slots = array->num_elements;
-    if (num_slots == 0)
-	return NULL;
-
-    slots = (cairo_user_data_slot_t *) (*array->elements);
+    slots = (cairo_user_data_slot_t *) array->elements;
     for (i = 0; i < num_slots; i++) {
 	if (slots[i].key == key)
 	    return slots[i].user_data;
@@ -428,19 +412,16 @@
 
     slot = NULL;
     num_slots = array->num_elements;
-
-    if (num_slots) {
-	slots = (cairo_user_data_slot_t *) (*array->elements);
-	for (i = 0; i < num_slots; i++) {
-	    if (slots[i].key == key) {
-		slot = &slots[i];
-		if (slot->destroy && slot->user_data)
-		    slot->destroy (slot->user_data);
-		break;
-	    }
-	    if (user_data && slots[i].user_data == NULL) {
-		slot = &slots[i];	/* Have to keep searching for an exact match */
-	    }
+    slots = (cairo_user_data_slot_t *) array->elements;
+    for (i = 0; i < num_slots; i++) {
+	if (slots[i].key == key) {
+	    slot = &slots[i];
+	    if (slot->destroy && slot->user_data)
+		slot->destroy (slot->user_data);
+	    break;
+	}
+	if (user_data && slots[i].user_data == NULL) {
+	    slot = &slots[i];	/* Have to keep searching for an exact match */
 	}
     }
 

Index: cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- cairo-meta-surface.c	21 Dec 2005 20:08:57 -0000	1.22
+++ cairo-meta-surface.c	21 Dec 2005 20:20:06 -0000	1.23
@@ -104,10 +104,7 @@
     }
 
     num_elements = meta->commands.num_elements;
-    if (num_elements == 0)
-	return CAIRO_STATUS_SUCCESS;
-
-    elements = (cairo_command_t **) *meta->commands.elements;
+    elements = (cairo_command_t **) meta->commands.elements;
     for (i = 0; i < num_elements; i++) {
 	command = elements[i];
 	switch (command->type) {
@@ -599,18 +596,16 @@
     cairo_meta_surface_t *meta;
     cairo_command_t *command, **elements;
     int i, num_elements;
-    cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
+    cairo_int_status_t status;
     cairo_clip_t clip;
 
     meta = (cairo_meta_surface_t *) surface;
-
-    num_elements = meta->commands.num_elements;
-    if (num_elements == 0)
-	return CAIRO_STATUS_SUCCESS;
+    status = CAIRO_STATUS_SUCCESS;
 
     _cairo_clip_init (&clip, target);    
 
-    elements = (cairo_command_t **) *meta->commands.elements;
+    num_elements = meta->commands.num_elements;
+    elements = (cairo_command_t **) meta->commands.elements;
     for (i = 0; i < num_elements; i++) {
 	command = elements[i];
 	switch (command->type) {

Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- cairo-win32-font.c	21 Dec 2005 20:08:57 -0000	1.46
+++ cairo-win32-font.c	21 Dec 2005 20:20:06 -0000	1.47
@@ -898,16 +898,14 @@
     if (status)
 	return status;
     
-    if (state->glyphs.elements) {
-	if (!ExtTextOutW (state->hdc,
-			  state->start_x, state->last_y,
-			  ETO_GLYPH_INDEX,
-			  NULL,
-			  (WCHAR *)*state->glyphs.elements,
-			  state->glyphs.num_elements,
-			  (int *)state->dx.elements)) {
-	    return _cairo_win32_print_gdi_error ("_flush_glyphs");
-	}
+    if (!ExtTextOutW (state->hdc,
+		      state->start_x, state->last_y,
+		      ETO_GLYPH_INDEX,
+		      NULL,
+		      (WCHAR *)state->glyphs.elements,
+		      state->glyphs.num_elements,
+		      (int *)state->dx.elements)) {
+	return _cairo_win32_print_gdi_error ("_flush_glyphs");
     }
     
     _cairo_array_truncate (&state->glyphs, 0);

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -d -r1.238 -r1.239
--- cairoint.h	21 Dec 2005 20:08:57 -0000	1.238
+++ cairoint.h	21 Dec 2005 20:20:06 -0000	1.239
@@ -334,7 +334,7 @@
     int size;
     int num_elements;
     int element_size;
-    char **elements;
+    char *elements;
 
     cairo_bool_t is_snapshot;
 };



More information about the cairo-commit mailing list