Commit d031a741 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

gegl/gegl-dot.c don't use sprintf.

2008-01-31  Sven Neumann  <sven@gimp.org>

	* gegl/gegl-dot.c
	* gegl/gegl-xml.c: don't use sprintf.

svn path=/trunk/; revision=1944
parent 7327d949
2008-01-31 Sven Neumann <sven@gimp.org>
* gegl/gegl-dot.c
* gegl/gegl-xml.c: don't use sprintf.
2008-01-31 Øyvind Kolås <pippin@gimp.org>
* operations/io/load.c: migrated to new chanting API.
......
......@@ -171,13 +171,11 @@ gegl_add_graph (GString *string,
GeglNode *node = entry->data;
{
GSList *connections = gegl_node_get_sinks (node);
GSList *entry;
entry = connections;
GSList *iter;
while (entry)
for (iter = connections; iter; iter = g_slist_next (iter))
{
GeglConnection *connection = entry->data;
gchar buf[512];
GeglConnection *connection = iter->data;
GeglNode *source;
GeglNode *sink;
GeglPad *source_pad;
......@@ -188,11 +186,9 @@ gegl_add_graph (GString *string,
source_pad = gegl_connection_get_source_pad (connection);
sink_pad = gegl_connection_get_sink_pad (connection);
sprintf (buf, "op_%p:%s -> op_%p:%s;\n", source,
gegl_pad_get_name (source_pad), sink,
gegl_pad_get_name (sink_pad));
g_string_append (string, buf);
entry = g_slist_next (entry);
g_string_append_printf (string, "op_%p:%s -> op_%p:%s;\n",
source, gegl_pad_get_name (source_pad),
sink, gegl_pad_get_name (sink_pad));
}
}
entry = g_slist_next (entry);
......@@ -205,9 +201,11 @@ gegl_add_graph (GString *string,
gchar *
gegl_to_dot (GeglNode *node)
{
GString *string = g_string_new ("digraph gegl { graph [ rankdir = \"BT\"];\n");
GString *string;
string = g_string_new ("digraph gegl { graph [ rankdir = \"BT\"];\n");
gegl_add_graph (string, node, "GEGL");
g_string_append (string, "}");
return g_string_free (string, FALSE);
}
......@@ -23,15 +23,16 @@
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "gegl-types.h"
#include "graph/gegl-node.h"
#include "graph/gegl-pad.h"
#include "operation/gegl-operation.h"
#include "property-types/gegl-color.h"
#include "property-types/gegl-curve.h"
#include "property-types/gegl-paramspecs.h"
#include "gegl-instrument.h"
#include "gegl-xml.h"
#include "property-types/gegl-paramspecs.h"
#include "operation/gegl-operation.h"
#ifdef G_OS_WIN32
#ifndef PATH_MAX
......@@ -127,14 +128,15 @@ set_clone_prop_as_well:
else if (pd->path_root)
{
gchar absolute_path[PATH_MAX];
sprintf (buf, "%s/%s", pd->path_root, param_value);
g_snprintf (buf, sizeof (buf),
"%s/%s", pd->path_root, param_value);
realpath (buf, absolute_path);
gegl_node_set (new, param_name, absolute_path, NULL);
}
else
{
gchar absolute_path[PATH_MAX];
sprintf (buf, "./%s", param_value);
g_snprintf (buf, sizeof (buf), "./%s", param_value);
realpath (buf, absolute_path);
gegl_node_set (new, param_name, absolute_path, NULL);
}
......@@ -621,7 +623,7 @@ encode_node_attributes_old (SerializeState *ss,
gint value;
gchar str[64];
gegl_node_get (node, properties[i]->name, &value, NULL);
sprintf (str, "%i", value);
g_snprintf (str, sizeof (str), "%i", value);
tuple_old (ss->buf, properties[i]->name, str);
}
else if (properties[i]->value_type == G_TYPE_BOOLEAN)
......@@ -698,7 +700,8 @@ add_stack_old (SerializeState *ss,
else
{
gchar temp_id[64];
sprintf (temp_id, "clone%i", ss->clone_count++);
g_snprintf (temp_id, sizeof (temp_id),
"clone%i", ss->clone_count++);
id = g_strdup (temp_id);
g_hash_table_insert (ss->clones, iter, (gchar *) id);
/* the allocation is freed by the hash table */
......@@ -1018,7 +1021,7 @@ serialize_properties (SerializeState *ss,
gint value;
gchar str[64];
gegl_node_get (node, properties[i]->name, &value, NULL);
sprintf (str, "%i", value);
g_snprintf (str, sizeof (str), "%i", value);
xml_param (ss, indent + 2, properties[i]->name, str);
}
else if (properties[i]->value_type == G_TYPE_BOOLEAN)
......@@ -1169,7 +1172,8 @@ add_stack (SerializeState *ss,
else
{
gchar temp_id[64];
sprintf (temp_id, "clone%i", ss->clone_count++);
g_snprintf (temp_id, sizeof (temp_id),
"clone%i", ss->clone_count++);
id = g_strdup (temp_id);
g_hash_table_insert (ss->clones, iter, (gchar *) id);
/* the allocation is freed by the hash table */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment