diff options
author | Carl Worth <cworth@cworth.org> | 2005-11-04 16:13:30 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2005-11-04 16:13:30 +0000 |
commit | 9341c254a00c732c9ce415233447ed47a7cbce7c (patch) | |
tree | 6f2b90045ebc9a24866c1d98e029f31ea52fe11a /src/cairo-win32-font.c | |
parent | feef096e2586d162c4ccd072bfadc39f1de4502a (diff) |
Rename old, rarely used _cairo_array_append to _cairo_array_append_multiple. Add much more common _cairo_array_append. Fix both to return a cairo_status_t. Remove undocumented code to allow a non-copying append when elements is NULL, (let's not encourage unintialized data, shall we?)
Cleanup to not rely on undocumented copy-avoidance in _cairo_array_append.
Track change in number of arguments and return value of _cairo_array_append.
Diffstat (limited to 'src/cairo-win32-font.c')
-rw-r--r-- | src/cairo-win32-font.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c index 4d4bb708..ab2deec2 100644 --- a/src/cairo-win32-font.c +++ b/src/cairo-win32-font.c @@ -891,9 +891,12 @@ _start_glyphs (cairo_glyph_state_t *state, static cairo_status_t _flush_glyphs (cairo_glyph_state_t *state) { + cairo_status_t status; int dx = 0; - if (!_cairo_array_append (&state->dx, &dx, 1)) - return CAIRO_STATUS_NO_MEMORY; + + status = _cairo_array_append (&state->dx, &dx); + if (status) + return status; if (!ExtTextOutW (state->hdc, state->start_x, state->last_y, @@ -917,6 +920,7 @@ _add_glyph (cairo_glyph_state_t *state, double device_x, double device_y) { + cairo_status_t status; double user_x = device_x; double user_y = device_y; WCHAR glyph_index = index; @@ -931,15 +935,16 @@ _add_glyph (cairo_glyph_state_t *state, int dx; if (logical_y != state->last_y) { - cairo_status_t status = _flush_glyphs (state); + status = _flush_glyphs (state); if (status) return status; state->start_x = logical_x; } dx = logical_x - state->last_x; - if (!_cairo_array_append (&state->dx, &dx, 1)) - return CAIRO_STATUS_NO_MEMORY; + status = _cairo_array_append (&state->dx, &dx); + if (status) + return status; } else { state->start_x = logical_x; } @@ -947,7 +952,9 @@ _add_glyph (cairo_glyph_state_t *state, state->last_x = logical_x; state->last_y = logical_y; - _cairo_array_append (&state->glyphs, &glyph_index, 1); + status = _cairo_array_append (&state->glyphs, &glyph_index); + if (status) + return status; return CAIRO_STATUS_SUCCESS; } |