From e7078147b37c5e57107f2c0d823bb45c5890bf0d Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 22 Jul 2009 01:21:35 +0000 Subject: [PATCH] Changed xml constructors to make them simpler with less implicit conversion routines. Trying to figure out what the issue is with the pc interface's /MD vs /MDd problems. --- Cantera/clib/src/ctxml.cpp | 2 +- Cantera/cxx/include/zerodim.h | 3 +++ Cantera/src/base/mdp_allo.cpp | 4 ++-- Cantera/src/base/xml.cpp | 15 +++++++++++++++ Cantera/src/base/xml.h | 13 ++++++++++++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Cantera/clib/src/ctxml.cpp b/Cantera/clib/src/ctxml.cpp index 80574898e..57b237293 100644 --- a/Cantera/clib/src/ctxml.cpp +++ b/Cantera/clib/src/ctxml.cpp @@ -41,7 +41,7 @@ extern "C" { if (!name) x = new XML_Node; else - x = new XML_Node(string(name)); + x = new XML_Node(name); return Cabinet::cabinet(true)->add(x); } diff --git a/Cantera/cxx/include/zerodim.h b/Cantera/cxx/include/zerodim.h index 68c6e760b..168039815 100644 --- a/Cantera/cxx/include/zerodim.h +++ b/Cantera/cxx/include/zerodim.h @@ -1,3 +1,6 @@ +/* + * $Id$ + */ #ifndef CT_INCL_ZERODIM_H #define CT_INCL_ZERODIM_H #include "kernel/Reactor.h" diff --git a/Cantera/src/base/mdp_allo.cpp b/Cantera/src/base/mdp_allo.cpp index 28d646fee..1d9f90e3f 100644 --- a/Cantera/src/base/mdp_allo.cpp +++ b/Cantera/src/base/mdp_allo.cpp @@ -346,7 +346,7 @@ namespace mdp { if (MDP_ALLO_errorOption == 7 || MDP_ALLO_errorOption == 5 || MDP_ALLO_errorOption == 3 || MDP_ALLO_errorOption == 1) { - (void) fprintf(stderr, "smalloc ERROR: Non-positive argument. (%d)\n", n); + (void) fprintf(stderr, "smalloc ERROR: Non-positive argument. (%d)\n", (int) n); return NULL; } } @@ -361,7 +361,7 @@ namespace mdp { MDP_ALLO_errorOption == 5 || MDP_ALLO_errorOption == 3 || MDP_ALLO_errorOption == 1) { fprintf(stderr, "smalloc : Out of space - number of bytes " - "requested = %d\n", n); + "requested = %d\n", (int) n); } } #ifdef MDP_MEMDEBUG diff --git a/Cantera/src/base/xml.cpp b/Cantera/src/base/xml.cpp index d582c9675..08a6f3dff 100755 --- a/Cantera/src/base/xml.cpp +++ b/Cantera/src/base/xml.cpp @@ -391,6 +391,21 @@ namespace Cantera { ////////////////////////// XML_Node ///////////////////////////////// + XML_Node::XML_Node(const char * cnm) + : m_value(""), + m_parent(0), + m_locked(false), + m_nchildren(0), + m_iscomment(false) + { + if (! cnm) { + m_name = "--"; + } else { + m_name = cnm; + } + m_root = this; + } + // Default constructor for XML_Node, representing a tree structure /* * Constructor for an XML_Node, which is a node in a tree-like structure diff --git a/Cantera/src/base/xml.h b/Cantera/src/base/xml.h index 351fc32bd..571f2436a 100755 --- a/Cantera/src/base/xml.h +++ b/Cantera/src/base/xml.h @@ -156,6 +156,17 @@ namespace Cantera { class XML_Node { public: + //! Default constructor for XML_Node, representing a tree structure + /*! + * Constructor for an XML_Node, which is a node in a tree-like structure + * representing an XML file. + * + * @param cnm Name of the node. + * The default name of the node is "--" + */ + XML_Node(const char * cnm = 0); + + //! Default constructor for XML_Node, representing a tree structure /*! * Constructor for an XML_Node, which is a node in a tree-like structure @@ -167,7 +178,7 @@ namespace Cantera { * @param p pointer to the root for this node in the tree. * The default is 0 indicating this is the top of the tree. */ - XML_Node(const std::string nm = "--", XML_Node * const p = 0); + XML_Node(const std::string nm, XML_Node * const p); //! Copy constructor /*!