From 284d3bdbbe725629f23232a42ada65668f06d889 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 6 Oct 2010 22:49:13 +0000 Subject: [PATCH] - Billy.. help!!! Your compiler stinks! (compiler fixes related to namespacing and xml) --- source/shared_lib/include/xml/xml_parser.h | 4 +-- .../sources/platform/win32/platform_util.cpp | 1 + source/shared_lib/sources/xml/xml_parser.cpp | 36 +++++++++---------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/source/shared_lib/include/xml/xml_parser.h b/source/shared_lib/include/xml/xml_parser.h index de3473871..ecfb850ea 100644 --- a/source/shared_lib/include/xml/xml_parser.h +++ b/source/shared_lib/include/xml/xml_parser.h @@ -101,8 +101,8 @@ public: ~XmlNode(); const string &getName() const {return name;} - int getChildCount() const {return children.size();} - int getAttributeCount() const {return attributes.size();} + size_t getChildCount() const {return children.size();} + size_t getAttributeCount() const {return attributes.size();} const string &getText() const {return text;} XmlAttribute *getAttribute(int i) const; diff --git a/source/shared_lib/sources/platform/win32/platform_util.cpp b/source/shared_lib/sources/platform/win32/platform_util.cpp index 5f90123bc..deefbcdaf 100644 --- a/source/shared_lib/sources/platform/win32/platform_util.cpp +++ b/source/shared_lib/sources/platform/win32/platform_util.cpp @@ -18,6 +18,7 @@ #include #include #include "SDL_syswm.h" +#include #include "leak_dumper.h" diff --git a/source/shared_lib/sources/xml/xml_parser.cpp b/source/shared_lib/sources/xml/xml_parser.cpp index 432598ddf..25241b612 100644 --- a/source/shared_lib/sources/xml/xml_parser.cpp +++ b/source/shared_lib/sources/xml/xml_parser.cpp @@ -15,18 +15,16 @@ #include #include "conversion.h" -#include "util.h" #include #include #include - +#include "util.h" #include "leak_dumper.h" XERCES_CPP_NAMESPACE_USE using namespace std; -using namespace Shared::Util; namespace Shared{ namespace Xml{ @@ -103,7 +101,7 @@ XmlNode *XmlIo::load(const string &path){ config->setParameter(XMLUni::fgXercesSchemaFullChecking, true); config->setParameter(XMLUni::fgDOMValidate, true); #endif - DOMDocument *document= parser->parseURI(path.c_str()); + XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document= parser->parseURI(path.c_str()); if(document==NULL){ throw runtime_error("Can not parse URL: " + path); @@ -124,10 +122,10 @@ void XmlIo::save(const string &path, const XmlNode *node){ XMLCh str[strSize]; XMLString::transcode(node->getName().c_str(), str, strSize-1); - DOMDocument *document= implementation->createDocument(0, str, 0); + XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document= implementation->createDocument(0, str, 0); DOMElement *documentElement= document->getDocumentElement(); - for(int i=0; igetChildCount(); ++i){ + for(unsigned int i=0; igetChildCount(); ++i){ documentElement->appendChild(node->getChild(i)->buildElement(document)); } @@ -194,7 +192,7 @@ XmlNode::XmlNode(DOMNode *node){ } //check children - for(int i=0; igetChildNodes()->getLength(); ++i){ + for(unsigned int i=0; igetChildNodes()->getLength(); ++i){ DOMNode *currentNode= node->getChildNodes()->item(i); if(currentNode->getNodeType()==DOMNode::ELEMENT_NODE){ XmlNode *xmlNode= new XmlNode(currentNode); @@ -205,7 +203,7 @@ XmlNode::XmlNode(DOMNode *node){ //check attributes DOMNamedNodeMap *domAttributes= node->getAttributes(); if(domAttributes!=NULL){ - for(int i=0; igetLength(); ++i){ + for(unsigned int i=0; igetLength(); ++i){ DOMNode *currentNode= domAttributes->item(i); if(currentNode->getNodeType()==DOMNode::ATTRIBUTE_NODE){ XmlAttribute *xmlAttribute= new XmlAttribute(domAttributes->item(i)); @@ -227,10 +225,10 @@ XmlNode::XmlNode(const string &name){ } XmlNode::~XmlNode(){ - for(int i=0; igetName()==name){ return attributes[i]; } @@ -264,7 +262,7 @@ XmlNode *XmlNode::getChild(const string &childName, int i) const{ } int count= 0; - for(int j=0; jgetName()==childName){ if(count==i){ return children[j]; @@ -279,7 +277,7 @@ XmlNode *XmlNode::getChild(const string &childName, int i) const{ bool XmlNode::hasChildAtIndex(const string &childName, int i) const { int count= 0; - for(int j = 0; j < children.size(); ++j) + for(unsigned int j = 0; j < children.size(); ++j) { if(children[j]->getName()==childName) { @@ -297,7 +295,7 @@ bool XmlNode::hasChildAtIndex(const string &childName, int i) const bool XmlNode::hasChild(const string &childName) const { int count= 0; - for(int j = 0; j < children.size(); ++j) + for(unsigned int j = 0; j < children.size(); ++j) { if(children[j]->getName()==childName) { @@ -320,13 +318,13 @@ XmlAttribute *XmlNode::addAttribute(const string &name, const string &value){ return attr; } -DOMElement *XmlNode::buildElement(DOMDocument *document) const{ +DOMElement *XmlNode::buildElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document) const{ XMLCh str[strSize]; XMLString::transcode(name.c_str(), str, strSize-1); DOMElement *node= document->createElement(str); - for(int i=0; igetName().c_str(), str, strSize-1); DOMAttr *attr= document->createAttribute(str); @@ -336,7 +334,7 @@ DOMElement *XmlNode::buildElement(DOMDocument *document) const{ node->setAttributeNode(attr); } - for(int i=0; iappendChild(children[i]->buildElement(document)); } @@ -350,7 +348,7 @@ string XmlNode::getTreeString() const{ if(!children.empty()){ str+= " ("; - for(int i=0; igetTreeString(); str+= " "; } @@ -419,7 +417,7 @@ const string &XmlAttribute::getRestrictedValue() const { const string allowedCharacters = "abcdefghijklmnopqrstuvwxyz1234567890._-/"; - for(int i= 0; i