forked from AuroraMiddleware/gtk
gtkcssimagelinear.c: Avoid VLAs
VLAs are not supported by Visual Studio and possibly other compilers that are supported by GTK+-3.90+, and probably never will be, although it is a C99 specification, and it became optional for C11. It is also not a part of the newer compiler requirements that are listed out for GTK+-3.90.x. There exist concerns about the implementation of VLAs in compilers that support them as well, so change it to a g_newa() approach. https://bugzilla.gnome.org/show_bug.cgi?id=773299
This commit is contained in:
parent
e64947662a
commit
23edff1606
@ -134,7 +134,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
|
|||||||
double height)
|
double height)
|
||||||
{
|
{
|
||||||
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
||||||
GskColorStop stops[linear->stops->len];
|
GskColorStop *stops;
|
||||||
GskRenderNode *node;
|
GskRenderNode *node;
|
||||||
double off_x, off_y; /* snapshot offset */
|
double off_x, off_y; /* snapshot offset */
|
||||||
double angle; /* actual angle of the gradiant line in degrees */
|
double angle; /* actual angle of the gradiant line in degrees */
|
||||||
@ -183,6 +183,8 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
|
|||||||
|
|
||||||
offset = start;
|
offset = start;
|
||||||
last = -1;
|
last = -1;
|
||||||
|
stops = g_newa (GskColorStop, linear->stops->len);
|
||||||
|
|
||||||
for (i = 0; i < linear->stops->len; i++)
|
for (i = 0; i < linear->stops->len; i++)
|
||||||
{
|
{
|
||||||
GtkCssImageLinearColorStop *stop;
|
GtkCssImageLinearColorStop *stop;
|
||||||
@ -238,6 +240,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
|
|||||||
stops,
|
stops,
|
||||||
linear->stops->len);
|
linear->stops->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = g_strdup_printf ("%sLinearGradient<%ustops>", linear->repeating ? "Repeating" : "", linear->stops->len);
|
name = g_strdup_printf ("%sLinearGradient<%ustops>", linear->repeating ? "Repeating" : "", linear->stops->len);
|
||||||
gsk_render_node_set_name (node, name);
|
gsk_render_node_set_name (node, name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
Loading…
Reference in New Issue
Block a user