X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0a704d3973860dac9e70460929d956e06703ac20..d989875a52208e35afbcbd04de7758089e06b985:/src/common/tarstrm.cpp diff --git a/src/common/tarstrm.cpp b/src/common/tarstrm.cpp index 398d7fffeb..65a4099d41 100644 --- a/src/common/tarstrm.cpp +++ b/src/common/tarstrm.cpp @@ -247,7 +247,7 @@ bool wxTarHeaderBlock::Write(wxOutputStream& out) return ok; } -bool wxTarHeaderBlock::WriteField(wxOutputStream& out, int id) +inline bool wxTarHeaderBlock::WriteField(wxOutputStream& out, int id) { return out.Write(Get(id), Len(id)).LastWrite() == Len(id); } @@ -289,7 +289,10 @@ bool wxTarHeaderBlock::SetPath(const wxString& name, wxMBConv& conv) size_t len = name.length(); wxCharBuffer approx(len); for (size_t i = 0; i < len; i++) - approx.data()[i] = name[i] & ~0x7F ? '_' : name[i]; + { + wxChar c = name[i]; + approx.data()[i] = c & ~0x7F ? '_' : c; + } nameBuf = approx; } @@ -381,7 +384,7 @@ static inline wxFileOffset GetDataSize(const wxTarEntry& entry) return 0; default: return entry.GetSize(); - }; + } } @@ -826,8 +829,8 @@ wxTarNumber wxTarInputStream::GetHeaderNumber(int id) const if ((value = GetExtendedHeader(m_hdr->Name(id))) != wxEmptyString) { wxTarNumber n = 0; - const wxChar *p = value; - while (*p == ' ') + wxString::const_iterator p = value.begin(); + while (*p == ' ' && p != value.end()) p++; while (isdigit(*p)) n = n * 10 + (*p++ - '0'); @@ -1265,7 +1268,7 @@ wxString wxTarOutputStream::PaxHeaderPath(const wxString& format, if (end == wxString::npos || end + 1 >= format.length()) break; ret << format.substr(begin, end - begin); - switch (format[end + 1]) { + switch ( format[end + 1].GetValue() ) { case 'd': ret << d; break; case 'f': ret << f; break; case 'p': ret << wxGetProcessId(); break; @@ -1359,11 +1362,16 @@ void wxTarOutputStream::SetExtendedHeader(const wxString& key, const wxString& value) { if (m_pax) { +#if wxUSE_UNICODE + const wxCharBuffer utf_key = key.utf8_str(); + const wxCharBuffer utf_value = value.utf8_str(); +#else const wxWX2WCbuf wide_key = key.wc_str(GetConv()); const wxCharBuffer utf_key = wxConvUTF8.cWC2MB(wide_key); const wxWX2WCbuf wide_value = value.wc_str(GetConv()); const wxCharBuffer utf_value = wxConvUTF8.cWC2MB(wide_value); +#endif // wxUSE_UNICODE/!wxUSE_UNICODE // a small buffer to format the length field in char buf[32];