summaryrefslogtreecommitdiffstats
path: root/src/attribute-rel-util.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-09-02 19:32:59 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-09-02 19:32:59 +0000
commitfd0a5dfa4cb237f8e5232c785693cc3e676336e8 (patch)
tree74bc967114726b2e9b87ba2439cdbfed03549dde /src/attribute-rel-util.cpp
parentperformance: ?? (diff)
downloadinkscape-fd0a5dfa4cb237f8e5232c785693cc3e676336e8.tar.gz
inkscape-fd0a5dfa4cb237f8e5232c785693cc3e676336e8.zip
converted some c-string usage to c++ string class usage: should fix some memory leaks
(bzr r11646)
Diffstat (limited to 'src/attribute-rel-util.cpp')
-rw-r--r--src/attribute-rel-util.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp
index 239e359e2..cf94c0c1e 100644
--- a/src/attribute-rel-util.cpp
+++ b/src/attribute-rel-util.cpp
@@ -128,17 +128,13 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) {
// Find element's style
SPCSSAttr *css = sp_repr_css_attr( repr, "style" );
-
sp_attribute_clean_style(repr, css, flags);
- // g_warning( "sp_repr_write_stream_element(): Final style:" );
- //sp_repr_css_print( css );
-
// Convert css node's properties data to string and set repr node's attribute "style" to that string.
// sp_repr_css_set( repr, css, "style"); // Don't use as it will cause loop.
- gchar *value = sp_repr_css_write_string(css);
- repr->setAttribute("style", value);
- if (value) g_free (value);
+ Glib::ustring value;
+ sp_repr_css_write_string(css, value);
+ repr->setAttribute("style", value.c_str());
sp_repr_css_attr_unref( css );
}
@@ -147,7 +143,7 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) {
/**
* Clean CSS style on an element.
*/
-gchar * sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int flags) {
+Glib::ustring sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int flags) {
g_return_val_if_fail (repr != NULL, NULL);
g_return_val_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE, NULL);
@@ -155,11 +151,12 @@ gchar * sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int f
SPCSSAttr *css = sp_repr_css_attr_new();
sp_repr_css_attr_add_from_string( css, string );
sp_attribute_clean_style(repr, css, flags);
- gchar* string_cleaned = sp_repr_css_write_string( css );
+ Glib::ustring string_cleaned;
+ sp_repr_css_write_string (css, string_cleaned);
sp_repr_css_attr_unref( css );
- return string_cleaned;
+ return string_cleaned;
}