app: further remove a variable length array.
Fixes when compiling: > error: variable length array ‘mask_row_buf’ is used With this and previous commit, we can now compile with C++ flags -Werror=vla and get no build failures.
This commit is contained in:
parent
9257af7570
commit
2c8d91c3cc
1 changed files with 20 additions and 2 deletions
|
|
@ -48,6 +48,9 @@ extern "C"
|
|||
(/* each thread costs as much as */ 64.0 * 64.0 /* pixels */)
|
||||
|
||||
|
||||
static gfloat *mask_row_buf = NULL;
|
||||
static gsize mask_row_buf_size = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint x;
|
||||
|
|
@ -189,6 +192,9 @@ gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
|
|||
}
|
||||
g_clear_object (&src_buffer);
|
||||
|
||||
g_clear_pointer (&mask_row_buf, g_free);
|
||||
mask_row_buf_size = 0;
|
||||
|
||||
return mask_buffer;
|
||||
}
|
||||
|
||||
|
|
@ -694,6 +700,9 @@ gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
|
|||
if (free_src_buffer)
|
||||
g_object_unref (src_buffer);
|
||||
|
||||
g_clear_pointer (&mask_row_buf, g_free);
|
||||
mask_row_buf_size = 0;
|
||||
|
||||
return mask_buffer;
|
||||
}
|
||||
|
||||
|
|
@ -990,10 +999,19 @@ find_contiguous_segment (const gfloat *col,
|
|||
gfloat *row)
|
||||
{
|
||||
gfloat *s;
|
||||
gfloat mask_row_buf[src_extent->width];
|
||||
gfloat *mask_row = mask_row_buf - src_extent->x;
|
||||
gfloat *mask_row;
|
||||
gfloat diff;
|
||||
|
||||
if (mask_row_buf == NULL ||
|
||||
(gsize) src_extent->width > mask_row_buf_size)
|
||||
{
|
||||
mask_row_buf_size = src_extent->width;
|
||||
mask_row_buf = (gfloat *) g_realloc_n ((gpointer) mask_row_buf,
|
||||
mask_row_buf_size,
|
||||
sizeof (gfloat));
|
||||
}
|
||||
mask_row = mask_row_buf - src_extent->x;
|
||||
|
||||
#ifdef FETCH_ROW
|
||||
gegl_buffer_get (src_buffer, GEGL_RECTANGLE (0, initial_y, width, 1), 1.0,
|
||||
src_format,
|
||||
|
|
|
|||
Loading…
Reference in a new issue