From: joncruz Date: Sat, 14 Mar 2009 08:19:42 +0000 (+0000) Subject: Work-around output encoding issues with comments. Fixes bug #340451. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6cebc619a06863b53a5d6e2baa0c52e859ba0448;p=inkscape.git Work-around output encoding issues with comments. Fixes bug #340451. --- 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: {