gegl r1945 - in trunk: . gegl/graph gegl/property-types
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r1945 - in trunk: . gegl/graph gegl/property-types
- Date: Thu, 31 Jan 2008 11:13:39 +0000 (GMT)
Author: neo
Date: Thu Jan 31 11:13:37 2008
New Revision: 1945
URL: http://svn.gnome.org/viewvc/gegl?rev=1945&view=rev
Log:
2008-01-31 Sven Neumann <sven gimp org>
* gegl/graph/gegl-node.c
* gegl/property-types/gegl-color.c: don't use sprintf.
Modified:
trunk/ChangeLog
trunk/gegl/graph/gegl-node.c
trunk/gegl/property-types/gegl-color.c
Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c (original)
+++ trunk/gegl/graph/gegl-node.c Thu Jan 31 11:13:37 2008
@@ -513,27 +513,23 @@
const GeglRectangle *rect,
gpointer data)
{
- GeglRectangle dirty_rect;
- GeglPad *destination_pad = GEGL_PAD (data);
- GeglNode *destination = GEGL_NODE (gegl_pad_get_node (destination_pad));
- gchar *source_name;
- gchar *destination_name;
-
- destination_name = g_strdup (gegl_node_get_debug_name (destination));
- source_name = g_strdup (gegl_node_get_debug_name (source));
+ GeglPad *destination_pad = GEGL_PAD (data);
+ GeglNode *destination = gegl_pad_get_node (destination_pad);
+ GeglRectangle dirty_rect;
if (0) g_warning ("%s.%s is dirtied from %s (%i,%i %ix%i)",
- destination_name,
+ gegl_node_get_debug_name (destination),
gegl_pad_get_name (destination_pad),
- source_name,
+ gegl_node_get_debug_name (source),
rect->x, rect->y,
rect->width, rect->height);
if (destination->operation)
{
- dirty_rect = gegl_operation_compute_affected_region (destination->operation,
- gegl_pad_get_name (destination_pad),
- rect);
+ dirty_rect =
+ gegl_operation_compute_affected_region (destination->operation,
+ gegl_pad_get_name (destination_pad),
+ rect);
}
else
{
@@ -541,9 +537,6 @@
}
gegl_node_invalidated (destination, &dirty_rect);
-
- g_free (source_name);
- g_free (destination_name);
}
gboolean
@@ -564,7 +557,8 @@
other_pad = gegl_pad_get_connected_to (pad);
else
{
- g_warning ("Didn't find pad '%s' of '%s'", sink_pad_name, gegl_node_get_debug_name (sink));
+ g_warning ("Didn't find pad '%s' of '%s'",
+ sink_pad_name, gegl_node_get_debug_name (sink));
}
if (other_pad)
@@ -1146,7 +1140,8 @@
if (!pspec)
{
g_warning ("%s:%s has no property named: '%s'",
- G_STRFUNC, gegl_node_get_debug_name (self), property_name);
+ G_STRFUNC,
+ gegl_node_get_debug_name (self), property_name);
break;
}
if (!(pspec->flags & G_PARAM_WRITABLE))
@@ -1232,7 +1227,8 @@
if (!pspec)
{
g_warning ("%s:%s has no property named: '%s'",
- G_STRFUNC, gegl_node_get_debug_name (self), property_name);
+ G_STRFUNC,
+ gegl_node_get_debug_name (self), property_name);
break;
}
if (!(pspec->flags & G_PARAM_READABLE))
@@ -1378,10 +1374,18 @@
if (gegl_node_get_name (node) != NULL &&
gegl_node_get_name (node)[0] != '\0')
- sprintf (ret_buf, "%s named %s", gegl_node_get_operation (node),
- gegl_node_get_name (node));
+ {
+ g_snprintf (ret_buf, sizeof (ret_buf),
+ "%s named %s",
+ gegl_node_get_operation (node), gegl_node_get_name (node));
+ }
else
- sprintf (ret_buf, "%s", gegl_node_get_operation (node));
+ {
+ g_snprintf (ret_buf, sizeof (ret_buf),
+ "%s",
+ gegl_node_get_operation (node));
+ }
+
return ret_buf;
}
@@ -1543,7 +1547,8 @@
context = gegl_node_get_context (self, context_id);
if (!context)
{
- g_warning ("didn't find context %p for %s", context_id, gegl_node_get_debug_name (self));
+ g_warning ("didn't find context %p for %s",
+ context_id, gegl_node_get_debug_name (self));
return;
}
self->context = g_slist_remove (self->context, context);
@@ -1639,7 +1644,8 @@
if (!pad)
{
- g_warning ("%s: no such pad %s for %s", G_STRFUNC, output_pad, gegl_node_get_debug_name (node));
+ g_warning ("%s: no such pad %s for %s",
+ G_STRFUNC, output_pad, gegl_node_get_debug_name (node));
return 0;
}
@@ -1882,8 +1888,9 @@
return node;
}
-GeglNode *gegl_node_create_child (GeglNode *self,
- const gchar *operation)
+GeglNode *
+gegl_node_create_child (GeglNode *self,
+ const gchar *operation)
{
return gegl_node_new_child (self, "operation", operation, NULL);
}
@@ -1893,27 +1900,17 @@
const GeglRectangle *rect,
gpointer data)
{
- GeglRectangle dirty_rect;
- GeglNode *destination = GEGL_NODE (data);
- gchar *source_name;
- gchar *destination_name;
-
- destination_name = g_strdup (gegl_node_get_debug_name (destination));
- source_name = g_strdup (gegl_node_get_debug_name (source));
+ GeglNode *destination = GEGL_NODE (data);
+ GeglRectangle dirty_rect = *rect;
if (0) g_warning ("graph:%s is dirtied from %s (%i,%i %ix%i)",
- destination_name,
- source_name,
+ gegl_node_get_debug_name (destination),
+ gegl_node_get_debug_name (source),
rect->x, rect->y,
rect->width, rect->height);
- dirty_rect = *rect;
-
g_signal_emit (destination, gegl_node_signals[INVALIDATED], 0,
&dirty_rect, NULL);
-
- g_free (source_name);
- g_free (destination_name);
}
Modified: trunk/gegl/property-types/gegl-color.c
==============================================================================
--- trunk/gegl/property-types/gegl-color.c (original)
+++ trunk/gegl/property-types/gegl-color.c Thu Jan 31 11:13:37 2008
@@ -342,26 +342,23 @@
static gchar *
gegl_color_get_string (GeglColor *color)
{
- GeglColorPrivate *priv;
- gchar buffer[512];
+ GeglColorPrivate *priv = GEGL_COLOR_GET_PRIVATE (color);
- priv = GEGL_COLOR_GET_PRIVATE (color);
if (priv->rgba_color[3] == 1.0)
{
- g_sprintf (buffer, "rgb(%1.4f, %1.4f, %1.4f)",
- priv->rgba_color[0],
- priv->rgba_color[1],
- priv->rgba_color[2]);
+ return g_strdup_printf ("rgb(%1.4f, %1.4f, %1.4f)",
+ priv->rgba_color[0],
+ priv->rgba_color[1],
+ priv->rgba_color[2]);
}
else
{
- g_sprintf (buffer, "rgba(%1.4f, %1.4f, %1.4f, %1.4f)",
- priv->rgba_color[0],
- priv->rgba_color[1],
- priv->rgba_color[2],
- priv->rgba_color[3]);
+ return g_strdup_printf ("rgba(%1.4f, %1.4f, %1.4f, %1.4f)",
+ priv->rgba_color[0],
+ priv->rgba_color[1],
+ priv->rgba_color[2],
+ priv->rgba_color[3]);
}
- return g_strdup (buffer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]