Improve the error messages slightly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41419 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell
2006-09-24 13:59:57 +00:00
parent 30f27c00d6
commit 076e07b60b

View File

@@ -87,6 +87,9 @@ wxFORCE_LINK_THIS_MODULE(zipstrm)
//
static wxString ReadString(wxInputStream& stream, wxUint16 len, wxMBConv& conv)
{
if (len == 0)
return wxEmptyString;
#if wxUSE_UNICODE
wxCharBuffer buf(len);
stream.Read(buf.data(), len);
@@ -758,7 +761,7 @@ wxString wxZipEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const
case wxPATH_DOS:
{
wxString name(isDir ? m_Name + _T("\\") : m_Name);
for (size_t i = name.length() - 1; i > 0; --i)
for (size_t i = 0; i < name.length(); i++)
if (name[i] == _T('/'))
name[i] = _T('\\');
return name;
@@ -1614,22 +1617,20 @@ wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/)
return wxSTREAM_EOF;
}
if (m_signature != LOCAL_MAGIC) {
wxLogError(_("error reading zip local header"));
return wxSTREAM_READ_ERROR;
if (m_signature == LOCAL_MAGIC) {
m_headerSize = m_entry.ReadLocal(*m_parent_i_stream, GetConv());
m_signature = 0;
m_entry.SetOffset(m_position);
m_entry.SetKey(m_position);
if (m_headerSize) {
m_TotalEntries++;
return wxSTREAM_NO_ERROR;
}
}
m_headerSize = m_entry.ReadLocal(*m_parent_i_stream, GetConv());
m_signature = 0;
m_entry.SetOffset(m_position);
m_entry.SetKey(m_position);
if (!m_headerSize) {
return wxSTREAM_READ_ERROR;
} else {
m_TotalEntries++;
return wxSTREAM_NO_ERROR;
}
wxLogError(_("error reading zip local header"));
return wxSTREAM_READ_ERROR;
}
wxUint32 wxZipInputStream::ReadSignature()