\membersection{wxGzipOutputStream::wxGzipOutputStream}\label{wxgzipoutputstreamwxgzipoutputstream}
-\func{}{wxGzipOutputStream}{\param{wxOutputStream\& }{stream}, \param{const wxString\& }{originalName = wxEmptyString}, \param{int }{level = -1}, \param{wxMBConv\& }{conv = wxConvFile}}
+\func{}{wxGzipOutputStream}{\param{wxOutputStream\& }{stream}, \param{const wxString\& }{originalName = wxEmptyString}, \param{const wxDateTime\& }{originalTime = wxDateTime::Now()}, \param{int }{level = -1}, \param{wxMBConv\& }{conv = wxConvFile}}
If the {\it originalName} is given, then it is written to the gzip header
with any directory components removed. On a Unicode build it is first
program. In a non-Unicode build {\it conv} is ignored. {\it conv} has no
effect on the stream data.
-If {\it originalName} specifies a file that exists then it's current
-modification time is also written to the gzip header as the timestamp.
-Otherwise the current time is used for the timestamp.
+If {\it originalTime} is given then it is also written to the gzip header
+as the timestamp. If omitted the current time is used.
{\it level} is the compression level. It can be an integer between $0$ (no
compression) and $9$ (most compression). $-1$ specifies that the default
public:
wxGzipOutputStream(wxOutputStream& stream,
const wxString& originalName = wxEmptyString,
+#if wxUSE_DATETIME
+ const wxDateTime& originalTime = wxDateTime::Now(),
+#endif
int level = -1,
wxMBConv& conv = wxConvFile);
virtual ~wxGzipOutputStream();
wxDataInputStream ds(*m_parent_i_stream);
m_lasterror = wxSTREAM_READ_ERROR;
- if (m_parent_i_stream->IsOk() && ds.Read32() != m_crc)
- wxLogError(_("reading Gzip stream: bad crc"));
- else if (m_parent_i_stream->IsOk() && ds.Read32() != (wxUint32)TellI())
- wxLogError(_("reading Gzip stream: incorrect length"));
- else if (m_parent_i_stream->IsOk())
- m_lasterror = wxSTREAM_EOF;
+ if (m_parent_i_stream->IsOk()) {
+ if (ds.Read32() != m_crc)
+ wxLogError(_("reading Gzip stream: bad crc"));
+ else if (ds.Read32() != (wxUint32)TellI())
+ wxLogError(_("reading Gzip stream: incorrect length"));
+ else
+ m_lasterror = wxSTREAM_EOF;
+ }
}
else if (!*m_decomp) {
m_lasterror = wxSTREAM_READ_ERROR;
// Output stream
wxGzipOutputStream::wxGzipOutputStream(
- wxOutputStream& stream,
- const wxString& originalName /*=wxEmptyString*/,
- int level /*=-1*/,
- wxMBConv& conv /*=wxConvFile*/)
+ wxOutputStream& stream,
+ const wxString& originalName /*=wxEmptyString*/,
+#if wxUSE_DATETIME
+ const wxDateTime& originalTime /*=wxDateTime::Now()*/,
+#endif
+ int level /*=-1*/,
+ wxMBConv& conv /*=wxConvFile*/)
: wxFilterOutputStream(stream)
{
m_comp = NULL;
wxFileName filename(originalName);
-#if wxUSE_DATETIME
- wxDateTime datetime;
-
- if (filename.FileExists())
- datetime = filename.GetModificationTime();
- else
- datetime = wxDateTime::Now();
-
- wxUint32 timestamp = (datetime.GetValue() / 1000L).GetLo();
-#else
wxUint32 timestamp = 0;
+#if wxUSE_DATETIME
+ if (originalTime.IsValid())
+ timestamp = (originalTime.GetValue() / 1000L).GetLo();
#endif
// RFC-1952 specifies ISO-8859-1 for the name. Also it should be just the