* wxStream: I've rewritten the inheritance
* added wxZlib*Stream * updated makefiles and data.cpp * modified a bit wxFile so I can use it in wxFile*Stream git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@263 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -58,6 +58,7 @@ LIB_CPP_SRC=\
|
||||
common/stream.cpp \
|
||||
common/fstream.cpp \
|
||||
common/mstream.cpp \
|
||||
common/zstream.cpp \
|
||||
common/datstrm.cpp \
|
||||
\
|
||||
gtk/app.cpp \
|
||||
|
@@ -105,6 +105,7 @@ bool wxFile::Exists(const char *sz)
|
||||
wxFile::wxFile(const char *szFileName, OpenMode mode)
|
||||
{
|
||||
m_fd = fd_invalid;
|
||||
m_error = FALSE;
|
||||
|
||||
Open(szFileName, mode);
|
||||
}
|
||||
@@ -202,17 +203,18 @@ off_t wxFile::Read(void *pBuf, off_t nCount)
|
||||
}
|
||||
|
||||
// write
|
||||
bool wxFile::Write(const void *pBuf, uint nCount)
|
||||
uint wxFile::Write(const void *pBuf, uint nCount)
|
||||
{
|
||||
wxCHECK( (pBuf != NULL) && IsOpened(), 0 );
|
||||
|
||||
int iRc = ::write(m_fd, pBuf, nCount);
|
||||
if ( iRc == -1 ) {
|
||||
wxLogSysError("can't write to file descriptor %d", m_fd);
|
||||
return FALSE;
|
||||
m_error = TRUE;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
return iRc;
|
||||
}
|
||||
|
||||
// flush
|
||||
@@ -235,21 +237,21 @@ bool wxFile::Flush()
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// seek
|
||||
off_t wxFile::Seek(off_t ofs, SeekMode mode)
|
||||
off_t wxFile::Seek(off_t ofs, wxSeekMode mode)
|
||||
{
|
||||
wxASSERT( IsOpened() );
|
||||
|
||||
int flag = -1;
|
||||
switch ( mode ) {
|
||||
case FromStart:
|
||||
case wxFromStart:
|
||||
flag = SEEK_SET;
|
||||
break;
|
||||
|
||||
case FromCurrent:
|
||||
case wxFromCurrent:
|
||||
flag = SEEK_CUR;
|
||||
break;
|
||||
|
||||
case FromEnd:
|
||||
case wxFromEnd:
|
||||
flag = SEEK_END;
|
||||
break;
|
||||
|
||||
|
@@ -13,93 +13,100 @@
|
||||
#pragma implementation "fstream.h"
|
||||
#endif
|
||||
|
||||
#include <wx/object.h>
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
#include <stdio.h>
|
||||
#include <wx/stream.h>
|
||||
#include <wx/fstream.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
|
||||
#define BUF_TEMP_SIZE 10000
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxFileStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxFileStream, wxInputStream, wxOutputStream)
|
||||
#endif
|
||||
|
||||
wxFileStreamBase::wxFileStreamBase(const wxString& fileName, int iolimit)
|
||||
: wxStream()
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileInputStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxFileInputStream::wxFileInputStream(const wxString& fileName)
|
||||
: wxFile(fileName, read)
|
||||
{
|
||||
char *open_mode;
|
||||
|
||||
switch (iolimit) {
|
||||
case 0:
|
||||
open_mode = "a+";
|
||||
break;
|
||||
case 1:
|
||||
open_mode = "rb";
|
||||
break;
|
||||
case 2:
|
||||
open_mode = "wb";
|
||||
break;
|
||||
}
|
||||
m_file = fopen(fileName, open_mode);
|
||||
fseek(m_file, 0, SEEK_SET);
|
||||
|
||||
m_eof = FALSE;
|
||||
m_bad = FALSE;
|
||||
m_lastread = 0;
|
||||
}
|
||||
|
||||
wxFileStreamBase::~wxFileStreamBase()
|
||||
wxFileInputStream::~wxFileInputStream()
|
||||
{
|
||||
fclose(m_file);
|
||||
}
|
||||
|
||||
wxInputStream& wxFileStreamBase::Read(void *buffer, size_t size)
|
||||
wxInputStream& wxFileInputStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
m_lastread = fread(buffer, 1, size, m_file);
|
||||
m_eof = feof(m_file);
|
||||
m_lastread = wxFile::Read(buffer, size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxOutputStream& wxFileStreamBase::Write(const void *buffer, size_t size)
|
||||
off_t wxFileInputStream::SeekI(off_t pos, wxSeekMode mode)
|
||||
{
|
||||
m_lastwrite = fwrite(buffer, 1, size, m_file);
|
||||
m_bad = ferror(m_file) != 0;
|
||||
return wxFile::Seek(pos, mode);
|
||||
}
|
||||
|
||||
off_t wxFileInputStream::TellI() const
|
||||
{
|
||||
return wxFile::Tell();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileOutputStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxFileOutputStream::wxFileOutputStream(const wxString& fileName)
|
||||
: wxFile(fileName, write)
|
||||
{
|
||||
m_lastwrite = 0;
|
||||
}
|
||||
|
||||
wxFileOutputStream::~wxFileOutputStream()
|
||||
{
|
||||
}
|
||||
|
||||
wxOutputStream& wxFileOutputStream::Write(const void *buffer, size_t size)
|
||||
{
|
||||
m_lastwrite = wxFile::Write(buffer, size);
|
||||
m_bad = wxFile::Error();
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t wxFileStreamBase::SeekI(int pos, wxWhenceType whence)
|
||||
off_t wxFileOutputStream::TellO() const
|
||||
{
|
||||
int real_whence;
|
||||
|
||||
if (whence == wxBeginPosition)
|
||||
real_whence = SEEK_SET;
|
||||
else if (whence == wxCurrentPosition)
|
||||
real_whence = SEEK_CUR;
|
||||
else if (whence == wxEndPosition)
|
||||
real_whence = SEEK_END;
|
||||
|
||||
fseek(m_file, pos, real_whence);
|
||||
return ftell(m_file);
|
||||
return wxFile::Tell();
|
||||
}
|
||||
|
||||
size_t wxFileStreamBase::TellI() const
|
||||
off_t wxFileOutputStream::SeekO(off_t pos, wxSeekMode mode)
|
||||
{
|
||||
return ftell(m_file);
|
||||
return wxFile::Seek(pos, mode);
|
||||
}
|
||||
|
||||
size_t wxFileStreamBase::TellO() const
|
||||
void wxFileOutputStream::Sync()
|
||||
{
|
||||
return ftell(m_file);
|
||||
wxFile::Flush();
|
||||
}
|
||||
|
||||
size_t wxFileStreamBase::SeekO(int pos, wxWhenceType whence)
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxFileStream::wxFileStream(const wxString& fileName)
|
||||
: wxFile(fileName, read_write)
|
||||
{
|
||||
return SeekI(pos, whence);
|
||||
}
|
||||
|
||||
void wxFileStreamBase::Sync()
|
||||
wxFileStream::~wxFileStream()
|
||||
{
|
||||
fflush(m_file);
|
||||
}
|
||||
|
@@ -13,32 +13,69 @@
|
||||
#pragma implementation "mstream.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
#include <stdlib.h>
|
||||
#include "wx/stream.h"
|
||||
#include "wx/mstream.h"
|
||||
#include <wx/stream.h>
|
||||
#include <wx/mstream.h>
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxMemoryStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxMemoryStreamBase)
|
||||
//IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxMemoryStreamBase)
|
||||
//IMPLEMENT_DYNAMIC_CLASS(wxMemoryStream, wxMemoryStreamBase)
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
wxMemoryStreamBase::wxMemoryStreamBase(char *data, size_t length, int iolimit)
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxMemoryOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxMemoryStream, wxInputStream, wxOutputStream)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMemoryStreamBase
|
||||
// ----------------------------------------------------------------------------
|
||||
wxMemoryStreamBase::wxMemoryStreamBase()
|
||||
{
|
||||
m_buffer = data;
|
||||
m_iolimit = iolimit;
|
||||
m_buffer = NULL;
|
||||
m_iolimit = 0;
|
||||
m_persistent = FALSE;
|
||||
m_length = length;
|
||||
m_position_i = m_position_o = 0;
|
||||
m_length = 0;
|
||||
}
|
||||
|
||||
wxMemoryStreamBase::~wxMemoryStreamBase()
|
||||
{
|
||||
free(m_buffer);
|
||||
if (!m_persistent && m_buffer)
|
||||
free(m_buffer);
|
||||
}
|
||||
|
||||
wxInputStream& wxMemoryStreamBase::Read(void *buffer, size_t size)
|
||||
bool wxMemoryStreamBase::ChangeBufferSize(size_t new_size)
|
||||
{
|
||||
if (m_iolimit == 1)
|
||||
return FALSE;
|
||||
|
||||
m_length = new_size;
|
||||
if (!m_buffer)
|
||||
m_buffer = (char *)malloc(m_length);
|
||||
else
|
||||
m_buffer = (char *)realloc(m_buffer, m_length);
|
||||
|
||||
return (m_buffer != NULL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMemoryInputStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
|
||||
{
|
||||
m_persistent = TRUE;
|
||||
m_length = len;
|
||||
m_buffer = (char *)data; // It's bad.
|
||||
m_position_i = 0;
|
||||
m_lastread = 0;
|
||||
m_eof = FALSE;
|
||||
m_iolimit = 1;
|
||||
}
|
||||
|
||||
wxInputStream& wxMemoryInputStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
if (m_iolimit == 2) {
|
||||
m_eof = TRUE;
|
||||
@@ -54,24 +91,24 @@ wxInputStream& wxMemoryStreamBase::Read(void *buffer, size_t size)
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t wxMemoryStreamBase::SeekI(int pos, wxWhenceType whence)
|
||||
off_t wxMemoryInputStream::SeekI(off_t pos, wxSeekMode mode)
|
||||
{
|
||||
if (m_iolimit == 2)
|
||||
return 0;
|
||||
|
||||
switch (whence) {
|
||||
case wxBeginPosition:
|
||||
switch (mode) {
|
||||
case wxFromStart:
|
||||
if ((size_t)pos > m_length)
|
||||
return m_position_i;
|
||||
return (m_position_i = pos);
|
||||
|
||||
case wxCurrentPosition:
|
||||
case wxFromCurrent:
|
||||
if ((size_t)(m_position_i+pos) > m_length)
|
||||
return m_position_i;
|
||||
|
||||
return (m_position_i += pos);
|
||||
|
||||
case wxEndPosition:
|
||||
case wxFromEnd:
|
||||
if ((size_t)(m_length-pos) > m_length)
|
||||
return m_position_i;
|
||||
|
||||
@@ -81,7 +118,22 @@ size_t wxMemoryStreamBase::SeekI(int pos, wxWhenceType whence)
|
||||
return m_position_i;
|
||||
}
|
||||
|
||||
wxOutputStream& wxMemoryStreamBase::Write(const void *buffer, size_t size)
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMemoryOutputStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
|
||||
{
|
||||
m_persistent = FALSE;
|
||||
m_buffer = data;
|
||||
m_length = len;
|
||||
m_position_o = 0;
|
||||
m_lastwrite = 0;
|
||||
m_bad = FALSE;
|
||||
m_iolimit = 2;
|
||||
}
|
||||
|
||||
wxOutputStream& wxMemoryOutputStream::Write(const void *buffer, size_t size)
|
||||
{
|
||||
if (m_iolimit == 1) {
|
||||
m_bad = TRUE;
|
||||
@@ -101,24 +153,24 @@ wxOutputStream& wxMemoryStreamBase::Write(const void *buffer, size_t size)
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t wxMemoryStreamBase::SeekO(int pos, wxWhenceType whence)
|
||||
off_t wxMemoryOutputStream::SeekO(off_t pos, wxSeekMode mode)
|
||||
{
|
||||
if (m_iolimit == 2)
|
||||
if (m_iolimit == 1)
|
||||
return 0;
|
||||
|
||||
switch (whence) {
|
||||
case wxBeginPosition:
|
||||
switch (mode) {
|
||||
case wxFromStart:
|
||||
if ((size_t)pos > m_length)
|
||||
return m_position_o;
|
||||
return (m_position_o = pos);
|
||||
|
||||
case wxCurrentPosition:
|
||||
case wxFromCurrent:
|
||||
if ((size_t)(m_position_o+pos) > m_length)
|
||||
return m_position_o;
|
||||
|
||||
return (m_position_o += pos);
|
||||
|
||||
case wxEndPosition:
|
||||
case wxFromEnd:
|
||||
if ((size_t)(m_length-pos) > m_length)
|
||||
return m_position_o;
|
||||
|
||||
@@ -128,13 +180,19 @@ size_t wxMemoryStreamBase::SeekO(int pos, wxWhenceType whence)
|
||||
return m_position_o;
|
||||
}
|
||||
|
||||
bool wxMemoryStreamBase::ChangeBufferSize(size_t new_size)
|
||||
{
|
||||
m_length = new_size;
|
||||
if (!m_buffer)
|
||||
m_buffer = (char *)malloc(m_length);
|
||||
else
|
||||
m_buffer = (char *)realloc(m_buffer, m_length);
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMemoryStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
return (m_buffer != NULL);
|
||||
wxMemoryStream::wxMemoryStream(char *data, size_t len)
|
||||
: wxMemoryInputStream(NULL, 0), wxMemoryOutputStream(NULL, 0)
|
||||
{
|
||||
m_persistent = FALSE;
|
||||
m_buffer = data;
|
||||
m_length = len;
|
||||
m_iolimit = 0;
|
||||
}
|
||||
|
||||
wxMemoryStream::~wxMemoryStream()
|
||||
{
|
||||
}
|
||||
|
@@ -15,22 +15,15 @@
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
#include <wx/stream.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/setup.h"
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/stream.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS2(wxStream, wxInputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS(wxFilterInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFilterOutputStream, wxOutputStream)
|
||||
#endif
|
||||
|
200
src/common/zstream.cpp
Normal file
200
src/common/zstream.cpp
Normal file
@@ -0,0 +1,200 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: zstream.cpp
|
||||
// Purpose: Compressed stream classes
|
||||
// Author: Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 11/07/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "zstream.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
#include <wx/stream.h>
|
||||
#include <wx/zstream.h>
|
||||
#include <wx/utils.h>
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxZlibInputStream, wxFilterInputStream)
|
||||
IMPLEMENT_CLASS(wxZlibOutputStream, wxFilterOutputStream)
|
||||
#endif
|
||||
|
||||
//////////////////////
|
||||
// wxZlibInputStream
|
||||
//////////////////////
|
||||
|
||||
wxZlibInputStream::wxZlibInputStream(wxInputStream& stream)
|
||||
: wxFilterInputStream(stream)
|
||||
{
|
||||
int err;
|
||||
|
||||
m_inflate.zalloc = (alloc_func)0;
|
||||
m_inflate.zfree = (free_func)0;
|
||||
m_inflate.opaque = (voidpf)0;
|
||||
|
||||
err = inflateInit(&m_inflate);
|
||||
if (err != Z_OK) {
|
||||
inflateEnd(&m_inflate);
|
||||
return;
|
||||
}
|
||||
|
||||
m_inflate.avail_in = 0;
|
||||
}
|
||||
|
||||
wxZlibInputStream::~wxZlibInputStream()
|
||||
{
|
||||
inflateEnd(&m_inflate);
|
||||
}
|
||||
|
||||
wxInputStream& wxZlibInputStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
int err;
|
||||
|
||||
m_inflate.next_out = (unsigned char *)buffer;
|
||||
m_inflate.avail_out = size;
|
||||
m_eof = FALSE;
|
||||
|
||||
while (m_inflate.avail_out > 0) {
|
||||
if (m_inflate.avail_in == 0) {
|
||||
wxFilterInputStream::Read(m_z_buffer, m_z_size);
|
||||
m_inflate.next_in = m_z_buffer;
|
||||
m_inflate.avail_in = wxFilterInputStream::LastRead();
|
||||
if (wxFilterInputStream::Eof()) {
|
||||
m_lastread = size - m_inflate.avail_out;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
err = inflate(&m_inflate, Z_FINISH);
|
||||
if (err == Z_STREAM_END) {
|
||||
m_lastread = size - m_inflate.avail_out;
|
||||
m_eof = TRUE;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
m_lastread = size;
|
||||
return *this;
|
||||
}
|
||||
|
||||
off_t wxZlibInputStream::SeekI(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
off_t wxZlibInputStream::TellI() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxZlibInputStream::Eof() const
|
||||
{
|
||||
if (!m_eof)
|
||||
return wxFilterInputStream::Eof();
|
||||
return m_eof;
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
// wxZlibOutputStream
|
||||
//////////////////////
|
||||
|
||||
wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream)
|
||||
: wxFilterOutputStream(stream)
|
||||
{
|
||||
int err;
|
||||
|
||||
m_deflate.zalloc = (alloc_func)0;
|
||||
m_deflate.zfree = (free_func)0;
|
||||
m_deflate.opaque = (voidpf)0;
|
||||
|
||||
err = deflateInit(&m_deflate, Z_DEFAULT_COMPRESSION);
|
||||
if (err != Z_OK) {
|
||||
deflateEnd(&m_deflate);
|
||||
return;
|
||||
}
|
||||
m_deflate.avail_in = 0;
|
||||
m_deflate.next_out = m_z_buffer;
|
||||
m_deflate.avail_out = m_z_size;
|
||||
}
|
||||
|
||||
wxZlibOutputStream::~wxZlibOutputStream()
|
||||
{
|
||||
int err;
|
||||
|
||||
while (1) {
|
||||
err = deflate(&m_deflate, Z_FINISH);
|
||||
if (err == Z_STREAM_END)
|
||||
break;
|
||||
if (err < 0) {
|
||||
wxDebugMsg("wxZlibOutputStream: error during final deflate");
|
||||
break;
|
||||
}
|
||||
if (m_deflate.avail_out == 0) {
|
||||
wxFilterOutputStream::Write(m_z_buffer, m_z_size);
|
||||
if (wxFilterOutputStream::Bad()) {
|
||||
wxDebugMsg("wxZlibOutputStream: error during final write");
|
||||
break;
|
||||
}
|
||||
m_deflate.next_out = m_z_buffer;
|
||||
m_deflate.avail_out = m_z_size;
|
||||
}
|
||||
}
|
||||
wxFilterOutputStream::Write(m_z_buffer, m_z_size-m_deflate.avail_out);
|
||||
|
||||
deflateEnd(&m_deflate);
|
||||
}
|
||||
|
||||
wxOutputStream& wxZlibOutputStream::Write(const void *buffer, size_t size)
|
||||
{
|
||||
int err;
|
||||
|
||||
m_deflate.next_in = (unsigned char *)buffer;
|
||||
m_deflate.avail_in = size;
|
||||
|
||||
m_bad = FALSE;
|
||||
while (m_deflate.avail_in > 0) {
|
||||
if (m_deflate.avail_out == 0) {
|
||||
wxFilterOutputStream::Write(m_z_buffer, m_z_size);
|
||||
if (wxFilterOutputStream::Bad()) {
|
||||
m_lastwrite = size - m_deflate.avail_in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
m_deflate.next_out = m_z_buffer;
|
||||
m_deflate.avail_out = m_z_size;
|
||||
}
|
||||
err = deflate(&m_deflate, Z_NO_FLUSH);
|
||||
if (err < 0) {
|
||||
m_bad = TRUE;
|
||||
m_lastwrite = size - m_deflate.avail_in;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
m_lastwrite = size;
|
||||
return *this;
|
||||
}
|
||||
|
||||
off_t wxZlibOutputStream::SeekO(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
off_t wxZlibOutputStream::TellO() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxZlibOutputStream::Bad() const
|
||||
{
|
||||
if (!m_bad)
|
||||
return wxFilterOutputStream::Bad();
|
||||
return m_bad;
|
||||
}
|
@@ -348,21 +348,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
|
||||
#include "wx/stream.h"
|
||||
#include "wx/fstream.h"
|
||||
#include "wx/mstream.h"
|
||||
#include "wx/zstream.h"
|
||||
#include "wx/datstrm.h"
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS2(wxStream, wxInputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS(wxFilterInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFilterOutputStream, wxOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxFileStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxFileStream, wxFileInputStream, wxFileOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxMemoryStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxMemoryOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxMemoryStream, wxMemoryInputStream, wxMemoryOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxZlibInputStream, wxFilterInputStream)
|
||||
IMPLEMENT_CLASS(wxZlibOutputStream, wxFilterOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxDataInputStream, wxFilterInputStream)
|
||||
IMPLEMENT_CLASS(wxDataOutputStream, wxFilterInputStream)
|
||||
|
@@ -348,21 +348,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
|
||||
#include "wx/stream.h"
|
||||
#include "wx/fstream.h"
|
||||
#include "wx/mstream.h"
|
||||
#include "wx/zstream.h"
|
||||
#include "wx/datstrm.h"
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS2(wxStream, wxInputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS(wxFilterInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFilterOutputStream, wxOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxFileStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxFileStream, wxFileInputStream, wxFileOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxMemoryStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxMemoryOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxMemoryStream, wxMemoryInputStream, wxMemoryOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxZlibInputStream, wxFilterInputStream)
|
||||
IMPLEMENT_CLASS(wxZlibOutputStream, wxFilterOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxDataInputStream, wxFilterInputStream)
|
||||
IMPLEMENT_CLASS(wxDataOutputStream, wxFilterInputStream)
|
||||
|
@@ -365,18 +365,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
|
||||
#include "wx/datstrm.h"
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS2(wxStream, wxInputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS(wxFilterInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFilterOutputStream, wxOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxFileStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxFileStreamBase)
|
||||
IMPLEMENT_CLASS(wxFileInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxFileOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxFileStream, wxFileInputStream, wxFileOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxMemoryStreamBase, wxStream)
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryStream, wxMemoryStreamBase)
|
||||
IMPLEMENT_CLASS(wxMemoryInputStream, wxInputStream)
|
||||
IMPLEMENT_CLASS(wxMemoryOutputStream, wxOutputStream)
|
||||
IMPLEMENT_CLASS2(wxMemoryStream, wxMemoryInputStream, wxMemoryOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxZlibInputStream, wxFilterInputStream)
|
||||
IMPLEMENT_CLASS(wxZlibOutputStream, wxFilterOutputStream)
|
||||
|
||||
IMPLEMENT_CLASS(wxDataInputStream, wxFilterInputStream)
|
||||
IMPLEMENT_CLASS(wxDataOutputStream, wxFilterInputStream)
|
||||
|
@@ -108,6 +108,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\stream.obj \
|
||||
$(MSWDIR)\fstream.obj \
|
||||
$(MSWDIR)\mstream.obj \
|
||||
$(MSWDIR)\zstream.obj \
|
||||
$(MSWDIR)\datstrm.obj \
|
||||
$(MSWDIR)\extended.obj
|
||||
|
||||
@@ -470,6 +471,8 @@ $(MSWDIR)\datstrm.obj: $(COMMDIR)\datstrm.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\mstream.obj: $(COMMDIR)\mstream.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\zstream.obj: $(COMMDIR)\zstream.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\fstream.obj: $(COMMDIR)\fstream.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\stream.obj: $(COMMDIR)\stream.$(SRCSUFF)
|
||||
|
@@ -109,6 +109,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\stream.obj \
|
||||
$(COMMDIR)\fstream.obj \
|
||||
$(COMMDIR)\mstream.obj \
|
||||
$(COMMDIR)\zstream.obj \
|
||||
$(COMMDIR)\datstrm.obj \
|
||||
$(COMMDIR)\extended.obj
|
||||
|
||||
|
@@ -114,6 +114,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)/stream.$(OBJSUFF) \
|
||||
$(COMMDIR)/fstream.$(OBJSUFF) \
|
||||
$(COMMDIR)/mstream.$(OBJSUFF) \
|
||||
$(COMMDIR)/zstream.$(OBJSUFF) \
|
||||
$(COMMDIR)/datstrm.$(OBJSUFF) \
|
||||
$(COMMDIR)/extended.$(OBJSUFF)
|
||||
|
||||
|
@@ -109,11 +109,11 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\y_tab.obj \
|
||||
$(COMMDIR)\extended.obj \
|
||||
$(COMMDIR)\process.obj
|
||||
|
||||
# $(COMMDIR)\fstream.obj \
|
||||
# $(COMMDIR)\mstream.obj \
|
||||
# $(COMMDIR)\datstrm.obj \
|
||||
# $(COMMDIR)\stream.obj \
|
||||
$(COMMDIR)\fstream.obj \
|
||||
$(COMMDIR)\mstream.obj \
|
||||
$(COMMDIR)\zstream.obj \
|
||||
$(COMMDIR)\stream.obj \
|
||||
$(COMMDIR)\datstrm.obj
|
||||
|
||||
MSWOBJS = \
|
||||
$(MSWDIR)\app.obj \
|
||||
@@ -889,6 +889,26 @@ $(COMMDIR)/time.obj: $*.$(SRCSUFF)
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
<<
|
||||
|
||||
$(COMMDIR)\stream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
<<
|
||||
|
||||
$(COMMDIR)\fstream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
<<
|
||||
|
||||
$(COMMDIR)\mstream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
<<
|
||||
|
||||
$(COMMDIR)\zstream.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
<<
|
||||
|
||||
$(COMMDIR)\datstrm.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
|
Reference in New Issue
Block a user