]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xml/xml.cpp
i18n files are installed as part of wxBase (and should be ideally part of separate...
[wxWidgets.git] / src / xml / xml.cpp
index b812bb331d86c07f70dd08170784faee8b7272bf..990d6aa81fb2e44650c88fd3c1824a7ea48d2223 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        xml.cpp
+// Name:        src/xml/xml.cpp
 // Purpose:     wxXmlDocument - XML parser & data holder class
 // Author:      Vaclav Slavik
 // Created:     2000/03/05
     #pragma hdrstop
 #endif
 
+#if wxUSE_XML
+
 #include "wx/xml/xml.h"
 
-#if wxUSE_XML
+#ifndef WX_PRECOMP
+    #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/app.h"
+#endif
 
 #include "wx/wfstream.h"
 #include "wx/datstrm.h"
 #include "wx/zstream.h"
-#include "wx/log.h"
-#include "wx/intl.h"
 #include "wx/strconv.h"
 
 #include "expat.h" // from Expat
 
 // DLL options compatibility check:
-#include "wx/app.h"
 WX_CHECK_BUILD_OPTIONS("wxXML")
 
 
@@ -345,12 +348,16 @@ void wxXmlDocument::DoCopy(const wxXmlDocument& doc)
 bool wxXmlDocument::Load(const wxString& filename, const wxString& encoding)
 {
     wxFileInputStream stream(filename);
+    if (!stream.Ok())
+        return false;
     return Load(stream, encoding);
 }
 
 bool wxXmlDocument::Save(const wxString& filename) const
 {
     wxFileOutputStream stream(filename);
+    if (!stream.Ok())
+        return false;
     return Save(stream);
 }
 
@@ -382,7 +389,7 @@ static wxString CharToString(wxMBConv *conv,
         const wxWCharBuffer wbuf(
             wxConvUTF8.cMB2WC(s, len == wxSTRING_MAXLEN ? wxNO_LEN : len, NULL));
 
-        return wxString(wbuf, conv);
+        return wxString(wbuf, *conv);
     }
     else // already in UTF-8, no conversion needed
     {