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)) { switch (wxFileName::GetFormat(format)) {
case wxPATH_DOS: case wxPATH_DOS:
{ {
wxString name(isDir ? m_Name + wxT("\\") : m_Name); wxString name(m_Name);
for (size_t i = 0; i < name.length(); i++) name.Replace(wxFILE_SEP_PATH_UNIX, wxFILE_SEP_PATH_DOS);
if (name[i] == wxT('/')) if (isDir)
name[i] = wxT('\\'); name += wxFILE_SEP_PATH_DOS;
return name; return name;
} }
case wxPATH_UNIX: case wxPATH_UNIX:
return isDir ? m_Name + wxT("/") : m_Name; return isDir ? m_Name + wxFILE_SEP_PATH_UNIX : m_Name;
default: default:
; ;