summaryrefslogtreecommitdiffstats
path: root/src/xml
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2018-09-24 22:00:28 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2018-09-29 21:04:56 +0000
commit485e68cc1dc477d7bb6c03924bece9bca8abc6bd (patch)
treef57824d091aaa523aa78d497d98df676d11ee0ea /src/xml
parentInkscapestream: Fix write methods for string types (diff)
downloadinkscape-485e68cc1dc477d7bb6c03924bece9bca8abc6bd.tar.gz
inkscape-485e68cc1dc477d7bb6c03924bece9bca8abc6bd.zip
Clean up stream output in repr-io.cpp
- remove workaround that was necessary because of broken writeString (and consequently printf) functions of BasicWriter - use writeChar() where appropriate as it's slightly more efficient than writeString()
Diffstat (limited to 'src/xml')
-rw-r--r--src/xml/repr-io.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 0fdd891a2..8e6a606e1 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -772,24 +772,15 @@ static void repr_write_comment( Writer &out, const gchar * val, bool addWhitespa
if (addWhitespace && indent) {
for (gint i = 0; i < indentLevel; i++) {
for (gint j = 0; j < indent; j++) {
- out.writeString(" ");
+ out.writeChar(' ');
}
}
}
- out.writeString("<!--");
- // WARNING out.printf() and out.writeString() are *NOT* non-ASCII friendly.
- if (val) {
- for (const gchar* cur = val; *cur; cur++ ) {
- out.writeChar(*cur);
- }
- } else {
- out.writeString(" ");
- }
- out.writeString("-->");
+ out.printf("<!--%s-->", val);
if (addWhitespace) {
- out.writeString("\n");
+ out.writeChar('\n');
}
}
@@ -976,7 +967,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out,
if (add_whitespace && indent) {
for (gint i = 0; i < indent_level; i++) {
for (gint j = 0; j < indent; j++) {
- out.writeString(" ");
+ out.writeChar(' ');
}
}
}
@@ -1002,11 +993,11 @@ void sp_repr_write_stream_element( Node * repr, Writer & out,
iter ; ++iter )
{
if (!inlineattrs) {
- out.writeString("\n");
+ out.writeChar('\n');
if (indent) {
for ( gint i = 0 ; i < indent_level + 1 ; i++ ) {
for ( gint j = 0 ; j < indent ; j++ ) {
- out.writeString(" ");
+ out.writeChar(' ');
}
}
}
@@ -1024,9 +1015,9 @@ void sp_repr_write_stream_element( Node * repr, Writer & out,
}
}
if (repr->firstChild()) {
- out.writeString( ">" );
+ out.writeChar('>');
if (loose && add_whitespace) {
- out.writeString( "\n" );
+ out.writeChar('\n');
}
for (child = repr->firstChild(); child != nullptr; child = child->next()) {
sp_repr_write_stream(child, out, ( loose ? indent_level + 1 : 0 ),
@@ -1037,7 +1028,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out,
if (loose && add_whitespace && indent) {
for (gint i = 0; i < indent_level; i++) {
for ( gint j = 0 ; j < indent ; j++ ) {
- out.writeString(" ");
+ out.writeChar(' ');
}
}
}
@@ -1050,7 +1041,7 @@ void sp_repr_write_stream_element( Node * repr, Writer & out,
// after closing text
if (add_whitespace || !strcmp (repr->name(), "svg:text")) {
- out.writeString( "\n" );
+ out.writeChar('\n');
}
}