summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog29
-rw-r--r--src/cairo-font.c6
-rw-r--r--src/cairo-ft-font.c7
-rw-r--r--src/cairo-gstate.c12
-rw-r--r--src/cairo-image-surface.c2
-rw-r--r--src/cairo-pdf-surface.c4
-rw-r--r--src/cairo-png.c4
-rw-r--r--src/cairo-ps-surface.c4
-rw-r--r--src/cairo-unicode.c28
-rw-r--r--src/cairo-xlib-surface.c5
-rw-r--r--src/cairo.c34
-rw-r--r--src/cairo.h14
-rw-r--r--src/cairoint.h36
13 files changed, 109 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 614de05e..356e4b69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2005-04-02 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h:
+ * src/cairo.c: (cairo_set_target_image), (cairo_text_extents),
+ (cairo_show_text), (cairo_text_path):
+ * src/cairo-image-surface.c: (cairo_image_surface_create_for_data):
+ * src/cairo-gstate.c: (_cairo_gstate_text_to_glyphs):
+ * src/cairo-font.c: (_cairo_font_create): Style and indentation
+ fixes.
+
+ * src/cairo-ft-font.c: (_cairo_ft_font_create): Add (unsigned
+ char*) cast to quiet new gcc-4 warnings.
+
+ * src/cairo-ft-font.c: (_cairo_ft_font_glyph_extents): Initialize
+ variables to quiet new gcc-4 warnings.
+
+ * src/cairo-pdf-surface.c: (cairo_pdf_ft_font_write_generic_table),
+ (cairo_pdf_ft_font_write_glyf_table):
+ * src/cairo-png.c: (cairo_surface_write_png),
+ (cairo_image_surface_create_for_png):
+ * src/cairo-xlib-surface.c: (_get_image_surface):
+ * src/cairo-ps-surface.c: (_cairo_ps_surface_copy_page):
+ Use unsigned char* as expected by freetype, libpng, Xlib, and zlib.
+
+ * src/cairoint.h:
+ * src/cairo-unicode.c: (_utf8_get_char), (_utf8_get_char_extended),
+ (_cairo_utf8_to_ucs4), (_cairo_utf8_to_utf16): Propagate unsigned
+ char* down from cairo_text_extents.
+
2005-04-01 Carl Worth <cworth@cworth.org>
* TODO: Update API shakeup chart.
diff --git a/src/cairo-font.c b/src/cairo-font.c
index 96492ee7..87f97b86 100644
--- a/src/cairo-font.c
+++ b/src/cairo-font.c
@@ -42,11 +42,11 @@
/* Now the internal "unscaled + scale" font API */
cairo_private cairo_status_t
-_cairo_font_create (const char *family,
+_cairo_font_create (const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight,
- cairo_font_scale_t *sc,
- cairo_font_t **font)
+ cairo_font_scale_t *sc,
+ cairo_font_t **font)
{
const cairo_font_backend_t *backend = CAIRO_FONT_BACKEND_DEFAULT;
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index c7e5e633..644afbe1 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -581,7 +581,7 @@ _ft_font_create (FcPattern *pattern,
}
static cairo_status_t
-_cairo_ft_font_create (const char *family,
+_cairo_ft_font_create (const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight,
cairo_font_scale_t *scale,
@@ -623,7 +623,7 @@ _cairo_ft_font_create (const char *family,
break;
}
- if (!FcPatternAddString (pattern, FC_FAMILY, family))
+ if (!FcPatternAddString (pattern, FC_FAMILY, (unsigned char *) family))
goto FREE_PATTERN;
if (!FcPatternAddInteger (pattern, FC_SLANT, fcslant))
goto FREE_PATTERN;
@@ -833,7 +833,8 @@ _cairo_ft_font_glyph_extents (void *abstract_font,
cairo_ft_font_t *font = abstract_font;
cairo_point_double_t origin;
cairo_point_double_t glyph_min, glyph_max;
- cairo_point_double_t total_min, total_max;
+ /* Initialize just to squelch anti-helpful compiler warning. */
+ cairo_point_double_t total_min = { 0, 0}, total_max = {0,0};
cairo_image_glyph_cache_entry_t *img = NULL;
cairo_cache_t *cache;
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index e856e9a0..c8d8427e 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -2366,10 +2366,10 @@ _cairo_gstate_get_font_extents (cairo_gstate_t *gstate,
}
cairo_status_t
-_cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate,
+_cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate,
const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *nglyphs)
+ cairo_glyph_t **glyphs,
+ int *num_glyphs)
{
cairo_status_t status;
@@ -2393,16 +2393,16 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate,
}
status = _cairo_font_text_to_glyphs (gstate->font,
- utf8, glyphs, nglyphs);
+ utf8, glyphs, num_glyphs);
- if (status || !glyphs || !nglyphs || !(*glyphs) || !(nglyphs))
+ if (status || !glyphs || !num_glyphs || !(*glyphs) || !(num_glyphs))
return status;
/* The font responded in glyph space, starting from (0,0). Convert to
user space by applying the font transform, then add any current point
offset. */
- for (i = 0; i < *nglyphs; ++i) {
+ for (i = 0; i < *num_glyphs; ++i) {
cairo_matrix_transform_point (&gstate->font_matrix,
&((*glyphs)[i].x),
&((*glyphs)[i].y));
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index abaec018..24122eec 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -195,7 +195,7 @@ cairo_image_surface_create (cairo_format_t format,
* be created because of lack of memory
**/
cairo_surface_t *
-cairo_image_surface_create_for_data (char *data,
+cairo_image_surface_create_for_data (char *data,
cairo_format_t format,
int width,
int height,
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index efdb7509..39e14d30 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -462,7 +462,7 @@ static int
cairo_pdf_ft_font_write_generic_table (cairo_pdf_ft_font_t *font,
unsigned long tag)
{
- char *buffer;
+ unsigned char *buffer;
unsigned long size;
size = 0;
@@ -480,7 +480,7 @@ cairo_pdf_ft_font_write_glyf_table (cairo_pdf_ft_font_t *font,
unsigned long start_offset, index, size;
TT_Header *header;
unsigned long begin, end;
- char *buffer;
+ unsigned char *buffer;
int i;
union {
unsigned char *bytes;
diff --git a/src/cairo-png.c b/src/cairo-png.c
index f7c00801..1a4fc76f 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -106,7 +106,7 @@ cairo_surface_write_png (cairo_surface_t *surface, FILE *file)
}
for (i = 0; i < image->height; i++)
- rows[i] = image->data + i * image->stride;
+ rows[i] = (png_byte *) image->data + i * image->stride;
png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png == NULL) {
@@ -322,7 +322,7 @@ cairo_image_surface_create_for_png (FILE *file, int *width, int *height)
if (height != NULL)
*height = png_height;
- return cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32,
+ return cairo_image_surface_create_for_data ((char *)data, CAIRO_FORMAT_ARGB32,
png_width, png_height, stride);
BAIL3:
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 9c89503c..ea23ad16 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -278,8 +278,8 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
int i, x, y;
cairo_solid_pattern_t white_pattern;
- char *rgb, *compressed;
- long rgb_size, compressed_size;
+ unsigned char *rgb, *compressed;
+ unsigned long rgb_size, compressed_size;
rgb_size = 3 * width * height;
rgb = malloc (rgb_size);
diff --git a/src/cairo-unicode.c b/src/cairo-unicode.c
index 92201391..8929baaa 100644
--- a/src/cairo-unicode.c
+++ b/src/cairo-unicode.c
@@ -117,14 +117,14 @@ static const char utf8_skip_data[256] = {
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
};
-#define UTF8_NEXT_CHAR(p) (char *)((p) + utf8_skip_data[*(unsigned char *)(p)])
+#define UTF8_NEXT_CHAR(p) ((p) + utf8_skip_data[*(unsigned char *)(p)])
/* Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
* If @p does not point to a valid UTF-8 encoded character, results are
* undefined.
**/
static uint32_t
-_utf8_get_char (const char *p)
+_utf8_get_char (const unsigned char *p)
{
int i, mask = 0, len;
uint32_t result;
@@ -142,8 +142,8 @@ _utf8_get_char (const char *p)
* and return (uint32_t)-2 on incomplete trailing character
*/
static uint32_t
-_utf8_get_char_extended (const char *p,
- long max_len)
+_utf8_get_char_extended (const unsigned char *p,
+ long max_len)
{
int i, len;
uint32_t wc = (unsigned char) *p;
@@ -220,14 +220,14 @@ _utf8_get_char_extended (const char *p,
* an invalid sequence was found.
**/
cairo_status_t
-_cairo_utf8_to_ucs4 (const char *str,
- int len,
- uint32_t **result,
- int *items_written)
+_cairo_utf8_to_ucs4 (const unsigned char *str,
+ int len,
+ uint32_t **result,
+ int *items_written)
{
uint32_t *str32 = NULL;
int n_chars, i;
- const char *in;
+ const unsigned char *in;
in = str;
n_chars = 0;
@@ -284,14 +284,14 @@ _cairo_utf8_to_ucs4 (const char *str,
* an invalid sequence was found.
**/
cairo_status_t
-_cairo_utf8_to_utf16 (const char *str,
- int len,
- uint16_t **result,
- int *items_written)
+_cairo_utf8_to_utf16 (const unsigned char *str,
+ int len,
+ uint16_t **result,
+ int *items_written)
{
uint16_t *str16 = NULL;
int n16, i;
- const char *in;
+ const unsigned char *in;
in = str;
n16 = 0;
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 40ee29f1..ea810818 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -183,9 +183,10 @@ _get_image_surface (cairo_xlib_surface_t *surface,
x2 = surface->width;
y2 = surface->height;
} else {
- int width, height;
+ unsigned int width, height;
Window root_ignore;
- int x_ignore, y_ignore, bwidth_ignore, depth_ignore;
+ int x_ignore, y_ignore;
+ unsigned int bwidth_ignore, depth_ignore;
XGetGeometry (surface->dpy,
surface->drawable,
diff --git a/src/cairo.c b/src/cairo.c
index 2df39dc8..142e6b27 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -331,10 +331,10 @@ slim_hidden_def(cairo_set_target_surface);
void
cairo_set_target_image (cairo_t *cr,
char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride)
+ cairo_format_t format,
+ int width,
+ int height,
+ int stride)
{
cairo_surface_t *surface;
@@ -1691,12 +1691,12 @@ cairo_transform_font (cairo_t *cr, cairo_matrix_t *matrix)
* affect the x_advance and y_advance values.
**/
void
-cairo_text_extents (cairo_t *cr,
- const unsigned char *utf8,
- cairo_text_extents_t *extents)
+cairo_text_extents (cairo_t *cr,
+ const unsigned char *utf8,
+ cairo_text_extents_t *extents)
{
cairo_glyph_t *glyphs = NULL;
- int nglyphs;
+ int num_glyphs;
CAIRO_CHECK_SANITY (cr);
if (cr->status)
@@ -1712,7 +1712,7 @@ cairo_text_extents (cairo_t *cr,
return;
}
- cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
+ cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &num_glyphs);
CAIRO_CHECK_SANITY (cr);
if (cr->status) {
@@ -1721,7 +1721,7 @@ cairo_text_extents (cairo_t *cr,
return;
}
- cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, nglyphs, extents);
+ cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs, extents);
CAIRO_CHECK_SANITY (cr);
if (glyphs)
@@ -1765,7 +1765,7 @@ void
cairo_show_text (cairo_t *cr, const unsigned char *utf8)
{
cairo_glyph_t *glyphs = NULL;
- int nglyphs;
+ int num_glyphs;
CAIRO_CHECK_SANITY (cr);
if (cr->status)
@@ -1774,7 +1774,8 @@ cairo_show_text (cairo_t *cr, const unsigned char *utf8)
if (utf8 == NULL)
return;
- cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
+ cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
+ &glyphs, &num_glyphs);
CAIRO_CHECK_SANITY (cr);
if (cr->status) {
@@ -1783,7 +1784,7 @@ cairo_show_text (cairo_t *cr, const unsigned char *utf8)
return;
}
- cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, nglyphs);
+ cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
CAIRO_CHECK_SANITY (cr);
if (glyphs)
@@ -1805,13 +1806,14 @@ void
cairo_text_path (cairo_t *cr, const unsigned char *utf8)
{
cairo_glyph_t *glyphs = NULL;
- int nglyphs;
+ int num_glyphs;
CAIRO_CHECK_SANITY (cr);
if (cr->status)
return;
- cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
+ cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
+ &glyphs, &num_glyphs);
CAIRO_CHECK_SANITY (cr);
if (cr->status) {
@@ -1820,7 +1822,7 @@ cairo_text_path (cairo_t *cr, const unsigned char *utf8)
return;
}
- cr->status = _cairo_gstate_glyph_path (cr->gstate, glyphs, nglyphs);
+ cr->status = _cairo_gstate_glyph_path (cr->gstate, glyphs, num_glyphs);
CAIRO_CHECK_SANITY (cr);
if (glyphs)
diff --git a/src/cairo.h b/src/cairo.h
index 274a47c5..876699c6 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -178,8 +178,8 @@ typedef enum cairo_format {
* we eliminate all the cairo_set_target functions.
*/
void
-cairo_set_target_image (cairo_t *cr,
- char *data,
+cairo_set_target_image (cairo_t *cr,
+ char *data,
cairo_format_t format,
int width,
int height,
@@ -919,7 +919,7 @@ cairo_image_surface_create (cairo_format_t format,
int height);
cairo_surface_t *
-cairo_image_surface_create_for_data (char *data,
+cairo_image_surface_create_for_data (char *data,
cairo_format_t format,
int width,
int height,
@@ -991,14 +991,14 @@ cairo_matrix_set_identity (cairo_matrix_t *matrix);
cairo_status_t
cairo_matrix_set_affine (cairo_matrix_t *matrix,
- double a, double b,
- double c, double d,
+ double a, double b,
+ double c, double d,
double tx, double ty);
cairo_status_t
cairo_matrix_get_affine (cairo_matrix_t *matrix,
- double *a, double *b,
- double *c, double *d,
+ double *a, double *b,
+ double *c, double *d,
double *tx, double *ty);
cairo_status_t
diff --git a/src/cairoint.h b/src/cairoint.h
index 5728554a..515fca38 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1144,10 +1144,10 @@ _cairo_gstate_set_font (cairo_gstate_t *gstate,
cairo_font_t *font);
cairo_private cairo_status_t
-_cairo_gstate_text_to_glyphs (cairo_gstate_t *font,
+_cairo_gstate_text_to_glyphs (cairo_gstate_t *font,
const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *num_glyphs);
+ cairo_glyph_t **glyphs,
+ int *num_glyphs);
cairo_private cairo_status_t
_cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
@@ -1186,11 +1186,11 @@ _cairo_color_set_alpha (cairo_color_t *color, double alpha);
/* cairo_font.c */
cairo_private cairo_status_t
-_cairo_font_create (const char *family,
+_cairo_font_create (const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight,
- cairo_font_scale_t *sc,
- cairo_font_t **font);
+ cairo_font_scale_t *sc,
+ cairo_font_t **font);
cairo_private void
_cairo_font_init (cairo_font_t *font,
@@ -1212,10 +1212,10 @@ _cairo_font_font_extents (cairo_font_t *font,
cairo_font_extents_t *extents);
cairo_private cairo_status_t
-_cairo_font_text_to_glyphs (cairo_font_t *font,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *num_glyphs);
+_cairo_font_text_to_glyphs (cairo_font_t *font,
+ const unsigned char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs);
cairo_private cairo_status_t
_cairo_font_glyph_extents (cairo_font_t *font,
@@ -1721,16 +1721,16 @@ _cairo_pattern_acquire_surfaces (cairo_pattern_t *src,
/* cairo_unicode.c */
cairo_private cairo_status_t
-_cairo_utf8_to_ucs4 (const char *str,
- int len,
- uint32_t **result,
- int *items_written);
+_cairo_utf8_to_ucs4 (const unsigned char *str,
+ int len,
+ uint32_t **result,
+ int *items_written);
cairo_private cairo_status_t
-_cairo_utf8_to_utf16 (const char *str,
- int len,
- uint16_t **result,
- int *items_written);
+_cairo_utf8_to_utf16 (const unsigned char *str,
+ int len,
+ uint16_t **result,
+ int *items_written);
/* cairo_output_stream.c */