From bbf9927e946ff41c43cdeb10db81b1fa203dbdbc Mon Sep 17 00:00:00 2001 From: Troels Knakkergaard Date: Sat, 6 Feb 2016 01:31:17 +0100 Subject: [PATCH] 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. --- src/common/zipstrm.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 71fb09be42..aa68db4bb4 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -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: ;