From 6cebc619a06863b53a5d6e2baa0c52e859ba0448 Mon Sep 17 00:00:00 2001 From: joncruz Date: Sat, 14 Mar 2009 08:19:42 +0000 Subject: [PATCH] Work-around output encoding issues with comments. Fixes bug #340451. --- src/xml/repr-io.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 3bc79a98c..e503540bb 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -662,6 +662,35 @@ repr_quote_write (Writer &out, const gchar * val) } } +static void repr_write_comment( Writer &out, const gchar * val, bool addWhitespace, gint indentLevel, int indent ) +{ + if ( indentLevel > 16 ) { + indentLevel = 16; + } + if (addWhitespace && indent) { + for (gint i = 0; i < indentLevel; i++) { + for (gint j = 0; j < indent; j++) { + out.writeString(" "); + } + } + } + + out.writeString(""); + + if (addWhitespace) { + out.writeString("\n"); + } +} + namespace { typedef std::map LocalNameMap; @@ -777,7 +806,7 @@ void sp_repr_write_stream( Node *repr, Writer &out, gint indent_level, break; } case Inkscape::XML::COMMENT_NODE: { - out.printf( "", repr->content() ); + repr_write_comment( out, repr->content(), add_whitespace, indent_level, indent ); break; } case Inkscape::XML::PI_NODE: { -- 2.30.2