projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed slider value rounding once again
[wxWidgets.git]
/
src
/
common
/
zipstrm.cpp
diff --git
a/src/common/zipstrm.cpp
b/src/common/zipstrm.cpp
index 54cb0c86387a67eba8b3ba6265672efb799b8c9b..fb191d35c330b953305a74205505cb64366c938b 100644
(file)
--- a/
src/common/zipstrm.cpp
+++ b/
src/common/zipstrm.cpp
@@
-39,13
+39,13
@@
wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file
m_Pos = 0;
m_Size = 0;
m_Pos = 0;
m_Size = 0;
- m_Archive = (void*) unzOpen(archive.
fn
_str());
+ m_Archive = (void*) unzOpen(archive.
mb
_str());
if (m_Archive == NULL)
{
m_lasterror = wxStream_READ_ERR;
return;
}
if (m_Archive == NULL)
{
m_lasterror = wxStream_READ_ERR;
return;
}
- if (unzLocateFile((unzFile)m_Archive, file.
fn
_str(), 0) != UNZ_OK)
+ if (unzLocateFile((unzFile)m_Archive, file.
mb
_str(), 0) != UNZ_OK)
{
m_lasterror = wxStream_READ_ERR;
return;
{
m_lasterror = wxStream_READ_ERR;
return;
@@
-73,13
+73,32
@@
wxZipInputStream::~wxZipInputStream()
}
}
}
}
+bool wxZipInputStream::Eof() const
+{
+ wxASSERT_MSG( m_Pos <= (off_t)m_Size,
+ _T("wxZipInputStream: invalid current position") );
+
+ return m_Pos >= (off_t)m_Size;
+}
size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize)
{
size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize)
{
- if (m_Pos + bufsize > m_Size) bufsize = m_Size - m_Pos;
+ wxASSERT_MSG( m_Pos <= (off_t)m_Size,
+ _T("wxZipInputStream: invalid current position") );
+
+ if ( m_Pos >= (off_t)m_Size )
+ {
+ m_lasterror = wxStream_EOF;
+ return 0;
+ }
+
+ if (m_Pos + bufsize > m_Size)
+ bufsize = m_Size - m_Pos;
+
unzReadCurrentFile((unzFile)m_Archive, buffer, bufsize);
m_Pos += bufsize;
unzReadCurrentFile((unzFile)m_Archive, buffer, bufsize);
m_Pos += bufsize;
+
return bufsize;
}
return bufsize;
}