Code

Rearrange to enable code that does not directly rely on lcms.
[inkscape.git] / src / dom / xmlwriter.cpp
index 08fd653e7626aa1404bb736f8a9ad762e3f398f2..2b056cf9fe10cf7bef82d6e31d91c328e1a22244 100644 (file)
@@ -10,7 +10,7 @@
  * Authors:
  *   Bob Jamison
  *
- * Copyright (C) 2005 Bob Jamison
+ * Copyright (C) 2005-2008 Bob Jamison
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -62,7 +62,7 @@ void XmlWriter::spaces()
 /**
  *
  */
-void XmlWriter::po(char *fmt, ...)
+void XmlWriter::po(const char *fmt, ...)
 {
     char str[257];
     va_list args;
@@ -82,14 +82,14 @@ void XmlWriter::pos(const DOMString &str)
 /**
  *
  */
-void XmlWriter::write(const Node *nodeArg)
+void XmlWriter::write(const NodePtr nodeArg)
 {
-    Node *node = (Node *)nodeArg;
+    NodePtr node = nodeArg;
 
     indent+=2;
 
-    NamedNodeMap *attributes = node->getAttributes();
-    int nrAttrs = attributes->getLength();
+    NamedNodeMap attributes = node->getAttributes();
+    int nrAttrs = attributes.getLength();
 
     //### Start open tag
     spaces();
@@ -101,7 +101,7 @@ void XmlWriter::write(const Node *nodeArg)
     //### Attributes
     for (int i=0 ; i<nrAttrs ; i++)
         {
-        Node *attr = attributes->item(i);
+        NodePtr attr = attributes.item(i);
         spaces();
         pos(attr->getNodeName());
         po("=\"");
@@ -119,8 +119,8 @@ void XmlWriter::write(const Node *nodeArg)
     pos(node->getNodeValue());
 
     //### Children
-    for (Node *child = node->getFirstChild() ;
-         child ;
+    for (NodePtr child = node->getFirstChild() ;
+         child.get() ;
          child=child->getNextSibling())
         {
         write(child);
@@ -139,7 +139,7 @@ void XmlWriter::write(const Node *nodeArg)
 /**
  *
  */
-void XmlWriter::writeFile(FILE *f, const Node *node)
+void XmlWriter::writeFile(FILE *f, const NodePtr node)
 {
     if (!node)
        {
@@ -155,7 +155,7 @@ void XmlWriter::writeFile(FILE *f, const Node *node)
 
     write(node);
 
-    for (int i=0 ; i<buf.size() ; i++)
+    for (unsigned int i=0 ; i<buf.size() ; i++)
         {
         int ch = buf[i];
         fputc(ch, f);