]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xml/xml.cpp
restored variabes initialization in OnButtonSet() to avoid spurious MSVC warnings
[wxWidgets.git] / src / xml / xml.cpp
index 6a76beb7c62e81220aa8a6cebd50983d25363caf..23c01e477ee56b2cab8654631c8a1e67df0df1f2 100644 (file)
@@ -386,7 +386,11 @@ void wxXmlDocument::DoCopy(const wxXmlDocument& doc)
     m_encoding = doc.m_encoding;
 #endif
     m_fileEncoding = doc.m_fileEncoding;
-    m_root = new wxXmlNode(*doc.m_root);
+
+    if (doc.m_root)
+        m_root = new wxXmlNode(*doc.m_root);
+    else
+        m_root = NULL;
 }
 
 bool wxXmlDocument::Load(const wxString& filename, const wxString& encoding, int flags)
@@ -414,7 +418,7 @@ bool wxXmlDocument::Save(const wxString& filename, int indentstep) const
 // converts Expat-produced string in UTF-8 into wxString using the specified
 // conv or keep in UTF-8 if conv is NULL
 static wxString CharToString(wxMBConv *conv,
-                                    const char *s, size_t len = wxSTRING_MAXLEN)
+                                    const char *s, size_t len = wxString::npos)
 {
 #if wxUSE_UNICODE
     wxUnusedVar(conv);
@@ -426,13 +430,13 @@ static wxString CharToString(wxMBConv *conv,
         // there can be no embedded NULs in this string so we don't need the
         // output length, it will be NUL-terminated
         const wxWCharBuffer wbuf(
-            wxConvUTF8.cMB2WC(s, len == wxSTRING_MAXLEN ? wxNO_LEN : len, NULL));
+            wxConvUTF8.cMB2WC(s, len == wxString::npos ? wxNO_LEN : len, NULL));
 
         return wxString(wbuf, *conv);
     }
     else // already in UTF-8, no conversion needed
     {
-        return wxString(s, len != wxSTRING_MAXLEN ? len : strlen(s));
+        return wxString(s, len != wxString::npos ? len : strlen(s));
     }
 #endif // wxUSE_UNICODE/!wxUSE_UNICODE
 }