From 027d18a8b5ee3bb08d6dbb552dac215c67ae4d26 Mon Sep 17 00:00:00 2001 From: olsner Date: Sat, 10 Jul 2004 18:57:13 +0000 Subject: [PATCH] Linux/GCC compat This was SVN commit r685. --- source/ps/CConsole.cpp | 1 + source/ps/Network/SocketBase.cpp | 3 +++ source/ps/Xeromyces.cpp | 24 +++++++++++++----------- source/ps/Xeromyces.h | 4 ++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index 348eb9d3e8..d4c12c372d 100755 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -1,4 +1,5 @@ #include "precompiled.h" +#include #include "CConsole.h" diff --git a/source/ps/Network/SocketBase.cpp b/source/ps/Network/SocketBase.cpp index 126541fb82..a67309f1fd 100755 --- a/source/ps/Network/SocketBase.cpp +++ b/source/ps/Network/SocketBase.cpp @@ -1,5 +1,8 @@ #include "precompiled.h" + +#ifdef _WIN32 #include "sysdep/win/win_internal.h" +#endif #include "Network.h" #include "NetworkInternal.h" diff --git a/source/ps/Xeromyces.cpp b/source/ps/Xeromyces.cpp index 4a1d6f83fe..4622d4dbb5 100755 --- a/source/ps/Xeromyces.cpp +++ b/source/ps/Xeromyces.cpp @@ -1,4 +1,4 @@ -// $Id: Xeromyces.cpp,v 1.2 2004/07/09 19:59:19 janwas Exp $ +// $Id: Xeromyces.cpp,v 1.3 2004/07/10 18:57:13 olsner Exp $ #include "precompiled.h" @@ -55,14 +55,14 @@ public: free(buffer); } - void write(void* data, int size) + void write(const void* data, int size) { while (length + size >= allocated) grow(); memcpy(&buffer[length], data, size); length += size; } - void write(void* data, int size, int offset) + void write(const void* data, int size, int offset) { assert(offset >= 0 && offset+size <= length); memcpy(&buffer[offset], data, size); @@ -220,8 +220,8 @@ void CXeromyces::Load(const char* filename) SAX2XMLReader* Parser = XMLReaderFactory::createXMLReader(); // Enable validation - Parser->setFeature(L"http://xml.org/sax/features/validation", true); - Parser->setFeature(L"http://apache.org/xml/features/validation/dynamic", true); + Parser->setFeature(XMLUni::fgSAX2CoreValidation, true); + Parser->setFeature(XMLUni::fgXercesDynamic, true); XeroHandler handler; Parser->setContentHandler(&handler); @@ -309,11 +309,12 @@ void XeroHandler::endDocument() { } -std::wstring lowercase(std::wstring a) +std::wstring lowercase(const XMLCh *a) { std::wstring b; - b.resize(a.length()); - for (size_t i = 0; i < a.length(); ++i) + uint len=XMLString::stringLen(a); + b.resize(len); + for (uint i = 0; i < len; ++i) b[i] = towlower(a[i]); return b; } @@ -334,7 +335,8 @@ void XeroHandler::startElement(const XMLCh* const uri, const XMLCh* const localn AttributeNames.insert(attrName); XMLAttribute* a = new XMLAttribute; a->name = attrName; - a->value = attrs.getValue(i); + const XMLCh *tmp = attrs.getValue(i); + a->value = std::wstring(tmp, tmp+XMLString::stringLen(tmp)); e->attrs.push_back(a); } @@ -352,7 +354,7 @@ void XeroHandler::endElement(const XMLCh* const uri, const XMLCh* const localnam void XeroHandler::characters(const XMLCh* const chars, const unsigned int length) { - ElementStack.top()->text += chars; + ElementStack.top()->text += std::wstring(chars, chars+XMLString::stringLen(chars)); } @@ -460,4 +462,4 @@ void XeroHandler::OutputElement(XMLElement* el) // Tidy up the parser's mess delete el; -} \ No newline at end of file +} diff --git a/source/ps/Xeromyces.h b/source/ps/Xeromyces.h index 7ebfacef11..29f1bbe81d 100755 --- a/source/ps/Xeromyces.h +++ b/source/ps/Xeromyces.h @@ -1,4 +1,4 @@ -/* $Id: Xeromyces.h,v 1.1 2004/07/08 15:21:42 philip Exp $ +/* $Id: Xeromyces.h,v 1.2 2004/07/10 18:57:13 olsner Exp $ Xeromyces file-loading interface. Automatically creates and caches relatively @@ -43,4 +43,4 @@ private: }; -#endif // _XEROMYCES_H_ \ No newline at end of file +#endif // _XEROMYCES_H_