diff --git a/contrib/utils/wxrc/wxrc.cpp b/contrib/utils/wxrc/wxrc.cpp
index 23b27952a7..60b353a02e 100644
--- a/contrib/utils/wxrc/wxrc.cpp
+++ b/contrib/utils/wxrc/wxrc.cpp
@@ -251,43 +251,55 @@ wxArrayString XmlResApp::PrepareTempFiles()
// find all files mentioned in structure, e.g. filename
void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath)
{
- wxXmlNode *n = node;
- if (n == NULL) return;
- n = n->GetChildren();
-
- while (n)
+ // Is 'node' XML node element?
+ if (node == NULL) return;
+ if (node->GetType() != wxXML_ELEMENT_NODE) return;
+
+ // Does 'node' contain filename information at all?
+ if (
+ // Any bitmaps:
+ (node->GetName() == _T("bitmap")) ||
+ // URLs in wxHtmlWindow:
+ (node->GetName() == _T("url")) ||
+ // wxBitmapButton:
+ (node->GetParent() != NULL &&
+ node->GetParent()->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") &&
+ (node->GetName() == _T("focus") ||
+ node->GetName() == _T("disabled") ||
+ node->GetName() == _T("selected")))
+ )
{
- if ((node->GetType() == wxXML_ELEMENT_NODE) &&
- // parent is an element, i.e. has subnodes...
- (n->GetType() == wxXML_TEXT_NODE ||
- n->GetType() == wxXML_CDATA_SECTION_NODE) &&
- // ...it is textnode...
- ((node/*not n!*/->GetName() == "bitmap") ||
- (node/*not n!*/->GetName() == "url")))
- // ...and known to contain filename
+ wxXmlNode *n = node->GetChildren();
+ while (n)
{
- wxString fullname;
- if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent();
- else fullname = inputPath + "/" + n->GetContent();
+ if (n->GetType() == wxXML_TEXT_NODE ||
+ n->GetType() == wxXML_CDATA_SECTION_NODE)
+ {
+ wxString fullname;
+ if (wxIsAbsolutePath(n->GetContent()) || inputPath == "")
+ fullname = n->GetContent();
+ else
+ fullname = inputPath + "/" + n->GetContent();
- if (flagVerbose)
- wxPrintf("adding " + fullname + "...\n");
-
- wxString filename = GetInternalFileName(n->GetContent(), flist);
- n->SetContent(filename);
+ if (flagVerbose)
+ wxPrintf("adding " + fullname + "...\n");
- flist.Add(filename);
+ wxString filename = GetInternalFileName(n->GetContent(), flist);
+ n->SetContent(filename);
- wxFileInputStream sin(fullname);
- wxFileOutputStream sout(parOutputPath + "/" + filename);
- sin.Read(sout); // copy the stream
+ flist.Add(filename);
+
+ wxFileInputStream sin(fullname);
+ wxFileOutputStream sout(parOutputPath + "/" + filename);
+ sin.Read(sout); // copy the stream
+ }
+
+ // subnodes:
+ if (n->GetType() == wxXML_ELEMENT_NODE)
+ FindFilesInXML(n, flist, inputPath);
+
+ n = n->GetNext();
}
-
- // subnodes:
- if (n->GetType() == wxXML_ELEMENT_NODE)
- FindFilesInXML(n, flist, inputPath);
-
- n = n->GetNext();
}
}
diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp
index 23b27952a7..60b353a02e 100644
--- a/utils/wxrc/wxrc.cpp
+++ b/utils/wxrc/wxrc.cpp
@@ -251,43 +251,55 @@ wxArrayString XmlResApp::PrepareTempFiles()
// find all files mentioned in structure, e.g. filename
void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath)
{
- wxXmlNode *n = node;
- if (n == NULL) return;
- n = n->GetChildren();
-
- while (n)
+ // Is 'node' XML node element?
+ if (node == NULL) return;
+ if (node->GetType() != wxXML_ELEMENT_NODE) return;
+
+ // Does 'node' contain filename information at all?
+ if (
+ // Any bitmaps:
+ (node->GetName() == _T("bitmap")) ||
+ // URLs in wxHtmlWindow:
+ (node->GetName() == _T("url")) ||
+ // wxBitmapButton:
+ (node->GetParent() != NULL &&
+ node->GetParent()->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") &&
+ (node->GetName() == _T("focus") ||
+ node->GetName() == _T("disabled") ||
+ node->GetName() == _T("selected")))
+ )
{
- if ((node->GetType() == wxXML_ELEMENT_NODE) &&
- // parent is an element, i.e. has subnodes...
- (n->GetType() == wxXML_TEXT_NODE ||
- n->GetType() == wxXML_CDATA_SECTION_NODE) &&
- // ...it is textnode...
- ((node/*not n!*/->GetName() == "bitmap") ||
- (node/*not n!*/->GetName() == "url")))
- // ...and known to contain filename
+ wxXmlNode *n = node->GetChildren();
+ while (n)
{
- wxString fullname;
- if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent();
- else fullname = inputPath + "/" + n->GetContent();
+ if (n->GetType() == wxXML_TEXT_NODE ||
+ n->GetType() == wxXML_CDATA_SECTION_NODE)
+ {
+ wxString fullname;
+ if (wxIsAbsolutePath(n->GetContent()) || inputPath == "")
+ fullname = n->GetContent();
+ else
+ fullname = inputPath + "/" + n->GetContent();
- if (flagVerbose)
- wxPrintf("adding " + fullname + "...\n");
-
- wxString filename = GetInternalFileName(n->GetContent(), flist);
- n->SetContent(filename);
+ if (flagVerbose)
+ wxPrintf("adding " + fullname + "...\n");
- flist.Add(filename);
+ wxString filename = GetInternalFileName(n->GetContent(), flist);
+ n->SetContent(filename);
- wxFileInputStream sin(fullname);
- wxFileOutputStream sout(parOutputPath + "/" + filename);
- sin.Read(sout); // copy the stream
+ flist.Add(filename);
+
+ wxFileInputStream sin(fullname);
+ wxFileOutputStream sout(parOutputPath + "/" + filename);
+ sin.Read(sout); // copy the stream
+ }
+
+ // subnodes:
+ if (n->GetType() == wxXML_ELEMENT_NODE)
+ FindFilesInXML(n, flist, inputPath);
+
+ n = n->GetNext();
}
-
- // subnodes:
- if (n->GetType() == wxXML_ELEMENT_NODE)
- FindFilesInXML(n, flist, inputPath);
-
- n = n->GetNext();
}
}