Minor simplification in wxZipEntry::GetName()

No real changes, just use wxString::Replace() instead of doing the replacement
manually.

Also use symbolic constants for [back]slashes.

See #16259.
This commit is contained in:
Troels Knakkergaard 2016-02-06 01:31:17 +01:00 committed by Vadim Zeitlin
parent 95fce84cf2
commit bbf9927e94

View File

@ -837,15 +837,15 @@ wxString wxZipEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const
switch (wxFileName::GetFormat(format)) {
case wxPATH_DOS:
{
wxString name(isDir ? m_Name + wxT("\\") : m_Name);
for (size_t i = 0; i < name.length(); i++)
if (name[i] == wxT('/'))
name[i] = wxT('\\');
wxString name(m_Name);
name.Replace(wxFILE_SEP_PATH_UNIX, wxFILE_SEP_PATH_DOS);
if (isDir)
name += wxFILE_SEP_PATH_DOS;
return name;
}
case wxPATH_UNIX:
return isDir ? m_Name + wxT("/") : m_Name;
return isDir ? m_Name + wxFILE_SEP_PATH_UNIX : m_Name;
default:
;