diff options
author | Jonathon Jongsma <jjongsma@gnome.org> | 2007-07-04 14:09:58 -0500 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2007-07-04 14:09:58 -0500 |
commit | a37414aa4f698a66550fbc87543efa0a74109b18 (patch) | |
tree | 19db4cae518cc1f547c83b7e0d1273e49645f8d8 | |
parent | ff62a63574de09ef59e06e854a60cedf244ddadc (diff) |
Context: fix a FIXME to match the style of ScaledFont::glyph_extents since MSVC
(and possibly other compilers) complain when allocating an array on the stack
and the size of the array is not a compile-time constante
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | cairomm/context.cc | 9 |
2 files changed, 12 insertions, 4 deletions
@@ -1,3 +1,10 @@ +2007-07-04 Jonathon Jongsma <jjongsma@gnome.org> + + * cairomm/context.cc: fix a FIXME to match the style of + ScaledFont::glyph_extents since MSVC (and possibly other compilers) complain + when allocating an array on the stack and the size of the array is not a + compile-time constante + 2007-04-16 Hugo Vincent <hugo.vincent@gmail.com> * Added QuartzSurface for MacOS X (when cairo is built with Quartz support), diff --git a/cairomm/context.cc b/cairomm/context.cc index e40e8d6..21855ac 100644 --- a/cairomm/context.cc +++ b/cairomm/context.cc @@ -604,14 +604,15 @@ double Context::get_miter_limit() const void Context::get_dash(std::vector<double>& dashes, double& offset) const { - // FIXME: do we need to allocate this array dynamically? I seem to remember - // some compilers have trouble with allocating arrays on the stack when the - // array size isn't a compile-time constant... + // Allocate this array dynamically because some compilers complain about + // allocating arrays on the stack when the array size isn't a compile-time + // constant... const int cnt = cairo_get_dash_count(m_cobject); - double dash_array[cnt]; + double* dash_array = new double[cnt]; cairo_get_dash(const_cast<cairo_t*>(m_cobject), dash_array, &offset); check_object_status_and_throw_exception(*this); dashes.assign(dash_array, dash_array + cnt); + delete[] dash_array; } void Context::get_matrix(Matrix& matrix) |