summaryrefslogtreecommitdiff
path: root/src/cairo-array.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-11-24 12:08:03 +0100
committerAndrea Canciani <ranma42@gmail.com>2010-11-24 14:45:19 +0100
commit493aaf0f15bfedc88371ffab07d862a400b0da38 (patch)
treeaf55f1ad9cef456ed5e9e04988fea2ac0a3d5b2a /src/cairo-array.c
parent9960f299ac3476d6d4c0d25d95a5891f6eab15dd (diff)
downloadcairo-493aaf0f15bfedc88371ffab07d862a400b0da38.tar.gz
array: Cleanup types
Const-ify where appropriate and make all index and element counts unsigned int. This is needed to enable accessing const cairo_array_t's without having to manually remove the const qualifier (which happens in the to-be-merged mesh pattern code, for example).
Diffstat (limited to 'src/cairo-array.c')
-rw-r--r--src/cairo-array.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/cairo-array.c b/src/cairo-array.c
index fde5d73e7..673ae5e16 100644
--- a/src/cairo-array.c
+++ b/src/cairo-array.c
@@ -1,3 +1,4 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2004 Red Hat, Inc
@@ -53,7 +54,7 @@
* called to free resources allocated during use of the array.
**/
void
-_cairo_array_init (cairo_array_t *array, int element_size)
+_cairo_array_init (cairo_array_t *array, unsigned int element_size)
{
array->size = 0;
array->num_elements = 0;
@@ -234,7 +235,9 @@ _cairo_array_index_const (const cairo_array_t *array, unsigned int index)
* location pointed to by @dst.
**/
void
-_cairo_array_copy_element (cairo_array_t *array, int index, void *dst)
+_cairo_array_copy_element (const cairo_array_t *array,
+ unsigned int index,
+ void *dst)
{
memcpy (dst, _cairo_array_index_const (array, index), array->element_size);
}
@@ -276,7 +279,7 @@ _cairo_array_append (cairo_array_t *array,
cairo_status_t
_cairo_array_append_multiple (cairo_array_t *array,
const void *elements,
- int num_elements)
+ unsigned int num_elements)
{
cairo_status_t status;
void *dest;
@@ -330,8 +333,8 @@ _cairo_array_allocate (cairo_array_t *array,
*
* This space was left intentionally blank, but gtk-doc filled it.
**/
-int
-_cairo_array_num_elements (cairo_array_t *array)
+unsigned int
+_cairo_array_num_elements (const cairo_array_t *array)
{
return array->num_elements;
}
@@ -344,8 +347,8 @@ _cairo_array_num_elements (cairo_array_t *array)
*
* This space was left intentionally blank, but gtk-doc filled it.
**/
-int
-_cairo_array_size (cairo_array_t *array)
+unsigned int
+_cairo_array_size (const cairo_array_t *array)
{
return array->size;
}
@@ -490,7 +493,7 @@ _cairo_user_data_array_set_data (cairo_user_data_array_t *array,
cairo_status_t
_cairo_user_data_array_copy (cairo_user_data_array_t *dst,
- cairo_user_data_array_t *src)
+ const cairo_user_data_array_t *src)
{
/* discard any existing user-data */
if (dst->num_elements != 0) {