From bdd030850eb6212240512ea86ed68890056c1cc7 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Tue, 17 Dec 2013 19:21:13 +0800 Subject: [PATCH] Fixed compiling errors for wxWidgets 2.8 --- src/wraplibxml.cpp | 8 ++++---- src/wrapxerces.cpp | 2 +- src/wrapxerces.h | 6 +++--- src/xmlcopyeditor.cpp | 5 +++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/wraplibxml.cpp b/src/wraplibxml.cpp index 19d0101..440eb5c 100644 --- a/src/wraplibxml.cpp +++ b/src/wraplibxml.cpp @@ -449,7 +449,7 @@ bool WrapLibxml::xslt ( CONV ( styleFileName ) ); if ( !cur ) { - nonParserError = "Cannot parse stylesheet"; + nonParserError = _("Cannot parse stylesheet"); return false; } @@ -470,7 +470,7 @@ bool WrapLibxml::xslt ( doc = xmlCtxtReadFile ( ctxt, CONV ( docUrl ), NULL, flags ); if ( !doc ) { - nonParserError = "Cannot parse file"; + nonParserError = _("Cannot parse file"); break; } @@ -481,7 +481,7 @@ bool WrapLibxml::xslt ( res = xsltApplyStylesheet ( cur, doc, NULL ); if ( !res ) { - nonParserError = "Cannot apply stylesheet"; + nonParserError = _("Cannot apply stylesheet"); break; } @@ -565,7 +565,7 @@ int WrapLibxml::saveEncoding ( docPtr = xmlCtxtReadMemory ( ctxt, utf8Buffer, utf8BufferSize, CONV ( fileNameSource ), "UTF-8", flags ); else - docPtr = xmlCtxtReadFile ( ctxt, fileNameSource.c_str(), NULL, flags ); + docPtr = xmlCtxtReadFile ( ctxt, CONV ( fileNameSource ), NULL, flags ); if ( !docPtr ) { xmlFreeParserCtxt ( ctxt ); diff --git a/src/wrapxerces.cpp b/src/wrapxerces.cpp index edba26c..363eb0b 100644 --- a/src/wrapxerces.cpp +++ b/src/wrapxerces.cpp @@ -206,7 +206,7 @@ wxMemoryBuffer WrapXerces::toString ( const wxString &str ) return buffer; } -void MySAX2Handler::logError ( const wxString &type, wxLogLevelValues level, +void MySAX2Handler::logError ( const wxString &type, wxLogLevel level, const SAXParseException& e ) { mErrors << wxString::Format ( diff --git a/src/wrapxerces.h b/src/wrapxerces.h index b9002d0..8d38fd8 100644 --- a/src/wrapxerces.h +++ b/src/wrapxerces.h @@ -43,7 +43,7 @@ class MySAX2Handler : public DefaultHandler public: MySAX2Handler() { - mEOL = "\n"; + mEOL = _T("\n"); resetErrors(); } void error ( const SAXParseException& e ) @@ -77,7 +77,7 @@ class MySAX2Handler : public DefaultHandler { return mErrorPosition; } - void logError ( const wxString &type, wxLogLevelValues level, + void logError ( const wxString &type, wxLogLevel level, const SAXParseException& e ); void setEOL ( const wxChar *eol ) { @@ -86,7 +86,7 @@ class MySAX2Handler : public DefaultHandler protected: wxString mErrors; std::pair mErrorPosition; - wxLogLevelValues mLevel; + wxLogLevel mLevel; wxString mEOL; }; diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 39d4b57..561417a 100644 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -3926,7 +3926,7 @@ void MyFrame::OnValidateSchema ( wxCommandEvent& event ) doc->clearErrorIndicators(); wxString fileName = doc->getFullFileName(); - wxString utf8Buffer = doc->myGetTextRaw(); + std::string utf8Buffer = doc->myGetTextRaw(); std::auto_ptr validator ( new WrapXerces() ); if ( !validator->validateMemory ( utf8Buffer.c_str(), utf8Buffer.size(), fileName ) ) @@ -4763,7 +4763,8 @@ bool MyFrame::saveFile ( XmlDoc *doc, wxString& fileName, bool checkLastModified { auto_ptr wl ( new WrapLibxml ( libxmlNetAccess ) ); int result = wl->saveEncoding ( utf8Buffer, - doc->getFullFileName(), fileName, NULL, encoding ); + doc->getFullFileName(), fileName, NULL, + wxString ( encoding.c_str(), wxConvUTF8 ) ); if ( result == -1 ) { success = saveRawUtf8 ( fileNameLocal, utf8Buffer, false, isXml );