From 528aa9f1dc343f0172cf3e6501acac63a7f6f5ea Mon Sep 17 00:00:00 2001 From: ishmal Date: Mon, 26 Jun 2006 03:44:10 +0000 Subject: [PATCH] Add code for printf() to allow %#s as xml-escaped string (cool, eh?) --- src/extension/internal/odf.cpp | 37 +++++----------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index fcb9c23d2..9a8d9ecfa 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -928,33 +928,6 @@ static Glib::ustring formatTransform(NR::Matrix &tf) } -/** - * Encode a string, checking for XML entities, to - * make an XML string safe for output - */ -static Glib::ustring toXml(const Glib::ustring &str) -{ - Glib::ustring outbuf; - for (unsigned int i=0 ; i') - outbuf.append(">"); - else if (ch == '"') - outbuf.append("""); - else if (ch == '\'') - outbuf.append("'"); - else - outbuf.push_back(ch); - } - return outbuf; -} - - @@ -1396,17 +1369,17 @@ bool OdfOutput::writeMeta(ZipFile &zf) outs.printf("office:version=\"1.0\">\n"); outs.printf("\n"); outs.printf(" Inkscape.org - 0.45\n"); - outs.printf(" %s\n", - toXml(creator).c_str()); - outs.printf(" %s\n", date.c_str()); + outs.printf(" %#s\n", + creator.c_str()); + outs.printf(" %#s\n", date.c_str()); for (iter = metadata.begin() ; iter != metadata.end() ; iter++) { Glib::ustring name = iter->first; Glib::ustring value = iter->second; if (name.size() > 0 && value.size()>0) { - outs.printf(" <%s>%s\n", - toXml(name).c_str(), toXml(value).c_str(), toXml(name).c_str()); + outs.printf(" <%#s>%#s\n", + name.c_str(), value.c_str(), name.c_str()); } } outs.printf(" 2\n"); -- 2.30.2