[cairo] Call for testers: Const status accessors
Andrea Canciani
ranma42 at gmail.com
Fri Aug 5 01:20:53 PDT 2011
The attached patch modifies cairo status accessors to accept a const
argument. This should be ok with C, but other languages might have
different issues.
I'd like if people using/maintaining bindings to cairo could test this
patch and report any problems it causes.
Thank you in advance
Andrea
-------------- next part --------------
From 64fc46b620a6de645ad66f87e6924ad8fc09a0de Mon Sep 17 00:00:00 2001
From: Andrea Canciani <ranma42 at gmail.com>
Date: Fri, 5 Aug 2011 10:10:55 +0200
Subject: [PATCH] api: Const-ify status accessors
In order to make the API consistent between cairo_region_status() and
other status accessors (without causing new warnings to existing
programs), all of the status accessors were modified to accept a const
argument with the following command:
sed -e 's/^\(cairo_.*status (\)cairo_/\1const cairo_/' -i.bak *.c *.h
This should not break existing programs, because it relaxes the API
and should not affect the ABI:
http://davidz25.blogspot.com/2011/07/writing-c-library-part-5.html#abi-api-versioning
---
src/cairo-device.c | 2 +-
src/cairo-font-face.c | 2 +-
src/cairo-font-options.c | 2 +-
src/cairo-pattern.c | 2 +-
src/cairo-scaled-font.c | 2 +-
src/cairo-surface.c | 2 +-
src/cairo-vg-surface.c | 2 +-
src/cairo-vg.h | 2 +-
src/cairo.c | 2 +-
src/cairo.h | 14 +++++++-------
10 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/cairo-device.c b/src/cairo-device.c
index fd1ec71..0d18842 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -225,7 +225,7 @@ slim_hidden_def (cairo_device_reference);
* Since: 1.10
**/
cairo_status_t
-cairo_device_status (cairo_device_t *device)
+cairo_device_status (const cairo_device_t *device)
{
if (device == NULL)
return CAIRO_STATUS_NULL_POINTER;
diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c
index e379b25..c45b1be 100644
--- a/src/cairo-font-face.c
+++ b/src/cairo-font-face.c
@@ -214,7 +214,7 @@ cairo_font_face_get_reference_count (cairo_font_face_t *font_face)
* %CAIRO_STATUS_NO_MEMORY.
**/
cairo_status_t
-cairo_font_face_status (cairo_font_face_t *font_face)
+cairo_font_face_status (const cairo_font_face_t *font_face)
{
return font_face->status;
}
diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c
index 521d371..52c501a 100644
--- a/src/cairo-font-options.c
+++ b/src/cairo-font-options.c
@@ -173,7 +173,7 @@ cairo_font_options_destroy (cairo_font_options_t *options)
* Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY
**/
cairo_status_t
-cairo_font_options_status (cairo_font_options_t *options)
+cairo_font_options_status (const cairo_font_options_t *options)
{
if (options == NULL)
return CAIRO_STATUS_NULL_POINTER;
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index cb6bba8..2668f5c 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1030,7 +1030,7 @@ cairo_pattern_get_type (cairo_pattern_t *pattern)
* or %CAIRO_STATUS_INVALID_MESH_CONSTRUCTION.
**/
cairo_status_t
-cairo_pattern_status (cairo_pattern_t *pattern)
+cairo_pattern_status (const cairo_pattern_t *pattern)
{
return pattern->status;
}
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index cb59bce..eef7e9e 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -312,7 +312,7 @@ cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font)
* %CAIRO_STATUS_NO_MEMORY.
**/
cairo_status_t
-cairo_scaled_font_status (cairo_scaled_font_t *scaled_font)
+cairo_scaled_font_status (const cairo_scaled_font_t *scaled_font)
{
return scaled_font->status;
}
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index b699393..88013ba 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -234,7 +234,7 @@ slim_hidden_def(cairo_surface_get_content);
* %CAIRO_STATUS_INVALID_VISUAL.
**/
cairo_status_t
-cairo_surface_status (cairo_surface_t *surface)
+cairo_surface_status (const cairo_surface_t *surface)
{
return surface->status;
}
diff --git a/src/cairo-vg-surface.c b/src/cairo-vg-surface.c
index 392ed0b..e2f13d2 100644
--- a/src/cairo-vg-surface.c
+++ b/src/cairo-vg-surface.c
@@ -1917,7 +1917,7 @@ cairo_vg_context_create_for_egl (EGLDisplay egl_display,
#endif
cairo_status_t
-cairo_vg_context_status (cairo_vg_context_t *context)
+cairo_vg_context_status (const cairo_vg_context_t *context)
{
return context->status;
}
diff --git a/src/cairo-vg.h b/src/cairo-vg.h
index f9a62e5..0511f76 100644
--- a/src/cairo-vg.h
+++ b/src/cairo-vg.h
@@ -67,7 +67,7 @@ cairo_vg_context_create_for_egl (EGLDisplay egl_display,
#endif
cairo_public cairo_status_t
-cairo_vg_context_status (cairo_vg_context_t *context);
+cairo_vg_context_status (const cairo_vg_context_t *context);
cairo_public void
cairo_vg_context_destroy (cairo_vg_context_t *context);
diff --git a/src/cairo.c b/src/cairo.c
index e58206b..f24def6 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -3832,7 +3832,7 @@ cairo_append_path (cairo_t *cr,
* Returns: the current status of this context, see #cairo_status_t
**/
cairo_status_t
-cairo_status (cairo_t *cr)
+cairo_status (const cairo_t *cr)
{
return cr->status;
}
diff --git a/src/cairo.h b/src/cairo.h
index 1eb30d7..36dc99f 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1269,7 +1269,7 @@ cairo_public void
cairo_font_options_destroy (cairo_font_options_t *options);
cairo_public cairo_status_t
-cairo_font_options_status (cairo_font_options_t *options);
+cairo_font_options_status (const cairo_font_options_t *options);
cairo_public void
cairo_font_options_merge (cairo_font_options_t *options,
@@ -1395,7 +1395,7 @@ cairo_public unsigned int
cairo_font_face_get_reference_count (cairo_font_face_t *font_face);
cairo_public cairo_status_t
-cairo_font_face_status (cairo_font_face_t *font_face);
+cairo_font_face_status (const cairo_font_face_t *font_face);
/**
@@ -1475,7 +1475,7 @@ cairo_public unsigned int
cairo_scaled_font_get_reference_count (cairo_scaled_font_t *scaled_font);
cairo_public cairo_status_t
-cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
+cairo_scaled_font_status (const cairo_scaled_font_t *scaled_font);
cairo_public cairo_font_type_t
cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
@@ -1980,7 +1980,7 @@ cairo_path_destroy (cairo_path_t *path);
/* Error status queries */
cairo_public cairo_status_t
-cairo_status (cairo_t *cr);
+cairo_status (const cairo_t *cr);
cairo_public const char *
cairo_status_to_string (cairo_status_t status);
@@ -2034,7 +2034,7 @@ cairo_public cairo_device_type_t
cairo_device_get_type (cairo_device_t *device);
cairo_public cairo_status_t
-cairo_device_status (cairo_device_t *device);
+cairo_device_status (const cairo_device_t *device);
cairo_public cairo_status_t
cairo_device_acquire (cairo_device_t *device);
@@ -2110,7 +2110,7 @@ cairo_public unsigned int
cairo_surface_get_reference_count (cairo_surface_t *surface);
cairo_public cairo_status_t
-cairo_surface_status (cairo_surface_t *surface);
+cairo_surface_status (const cairo_surface_t *surface);
/**
* cairo_surface_type_t:
@@ -2376,7 +2376,7 @@ cairo_public unsigned int
cairo_pattern_get_reference_count (cairo_pattern_t *pattern);
cairo_public cairo_status_t
-cairo_pattern_status (cairo_pattern_t *pattern);
+cairo_pattern_status (const cairo_pattern_t *pattern);
cairo_public void *
cairo_pattern_get_user_data (cairo_pattern_t *pattern,
--
1.7.1
More information about the cairo
mailing list