/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation
+#pragma implementation "zipstream.h"
#endif
-#include <wx/wxprec.h>
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
-#ifdef __BORDLANDC__
-#pragma hdrstop
+#ifdef __BORLANDC__
+ #pragma hdrstop
#endif
-#ifndef WXPRECOMP
-#include <wx/wx.h>
-#endif
-
-#if wxUSE_ZLIB && wxUSE_STREAMS && wxUSE_ZIPSTREAM
+#if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
-#include <wx/stream.h>
-#include <wx/wfstream.h>
-#include <wx/zipstream.h>
+#include "wx/log.h"
+#include "wx/intl.h"
+#include "wx/stream.h"
+#include "wx/wfstream.h"
+#include "wx/zipstream.h"
#include "unzip.h"
-
-
-
wxZipInputStream::wxZipInputStream(const wxString& archive, const wxString& file) : wxInputStream()
{
unz_file_info zinfo;
m_Pos = 0;
m_Size = 0;
- m_Archive = (void*) unzOpen(archive);
- if (m_Archive == NULL) {
+ m_Archive = (void*) unzOpen(archive.mb_str(wxConvFile));
+ if (m_Archive == NULL)
+ {
m_lasterror = wxStream_READ_ERR;
return;
}
- if (unzLocateFile((unzFile)m_Archive, file, 0) != UNZ_OK) {
+ if (unzLocateFile((unzFile)m_Archive, file.mb_str(wxConvFile), 0) != UNZ_OK)
+ {
m_lasterror = wxStream_READ_ERR;
return;
}
- unzGetCurrentFileInfo((unzFile)m_Archive, &zinfo, NULL, 0, NULL, 0, NULL, 0);
+
+ unzGetCurrentFileInfo((unzFile)m_Archive, &zinfo, (char*) NULL, 0, (void*) NULL, 0, (char*) NULL, 0);
- if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK) {
+ if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK)
+ {
m_lasterror = wxStream_READ_ERR;
return;
}
wxZipInputStream::~wxZipInputStream()
{
- if (m_Archive) {
+ if (m_Archive)
+ {
if (m_Size != 0)
unzCloseCurrentFile((unzFile)m_Archive);
unzClose((unzFile)m_Archive);
off_t nextpos;
void *buf;
- switch (mode) {
+ switch (mode)
+ {
case wxFromCurrent : nextpos = seek + m_Pos; break;
case wxFromStart : nextpos = seek; break;
case wxFromEnd : nextpos = m_Size - 1 + seek; break;
}
// cheated seeking :
- if (nextpos > m_Pos) {
+ if (nextpos > m_Pos)
+ {
buf = malloc(nextpos - m_Pos);
unzReadCurrentFile((unzFile)m_Archive, buf, nextpos - m_Pos);
free(buf);
}
else if (nextpos < m_Pos) {
unzCloseCurrentFile((unzFile)m_Archive);
- if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK) {
+ if (unzOpenCurrentFile((unzFile)m_Archive) != UNZ_OK)
+ {
m_lasterror = wxStream_READ_ERR;
return m_Pos;
}
}
#endif
+ // wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB