]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/props_io.cxx
MSVC++ bug work-around from Frederic Bouvier.
[simgear.git] / simgear / misc / props_io.cxx
index 7c1f8bee551989f11d90f398796ace41662a9cc9..45f8829665f7d5f85b69d122066e0b5800dba413 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "sg_path.hxx"
 #include "props.hxx"
+#include "props_io.hxx"
 
 #include STL_IOSTREAM
 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
@@ -234,9 +235,9 @@ PropsVisitor::endElement (const char * name)
     } else if (st.type == "double") {
       ret = st.node->setDoubleValue(strtod(_data.c_str(), 0));
     } else if (st.type == "string") {
-      ret = st.node->setStringValue(_data);
+      ret = st.node->setStringValue(_data.c_str());
     } else if (st.type == "unspecified") {
-      ret = st.node->setUnspecifiedValue(_data);
+      ret = st.node->setUnspecifiedValue(_data.c_str());
     } else {
       string message = "Unrecognized data type '";
       message += st.type;
@@ -437,12 +438,12 @@ writeNode (ostream &output, const SGPropertyNode * node,
   if (!write_all && !isArchivable(node))
     return true;               // Everything's OK, but we won't write.
 
-  const string &name = node->getName();
+  const string name = node->getName();
   int nChildren = node->nChildren();
 
                                // If there is a literal value,
                                // write it first.
-  if (node->hasValue() && node->getAttribute(SGPropertyNode::ARCHIVE)) {
+  if (node->hasValue() && (write_all || node->getAttribute(SGPropertyNode::ARCHIVE))) {
     doIndent(output, indent);
     output << '<' << name;
     writeAtts(output, node);