added compression ratio argument to wxZlibOutputStream ctor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -38,3 +38,14 @@ to the "filtered" stream.
|
|||||||
|
|
||||||
\helpref{wxOutputStream}{wxoutputstream}
|
\helpref{wxOutputStream}{wxoutputstream}
|
||||||
|
|
||||||
|
|
||||||
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
\membersection{wxZlibOutputStream::wxZlibOutputStream}
|
||||||
|
|
||||||
|
\func{}{wxZlibOutputStream}{\param{wxOutputStream\&}{ stream},\param{int}{ level = -1}}
|
||||||
|
|
||||||
|
Creates a new write-only compressed stream. {\it level} means level of
|
||||||
|
compression. It is number between 0 and 9 (including these values) where
|
||||||
|
0 means no compression and 9 best but slowest compression. -1 is default
|
||||||
|
value (currently equivalent to 6).
|
||||||
|
@@ -37,7 +37,7 @@ class WXDLLEXPORT wxZlibInputStream: public wxFilterInputStream {
|
|||||||
|
|
||||||
class WXDLLEXPORT wxZlibOutputStream: public wxFilterOutputStream {
|
class WXDLLEXPORT wxZlibOutputStream: public wxFilterOutputStream {
|
||||||
public:
|
public:
|
||||||
wxZlibOutputStream(wxOutputStream& stream);
|
wxZlibOutputStream(wxOutputStream& stream, int level = -1);
|
||||||
virtual ~wxZlibOutputStream();
|
virtual ~wxZlibOutputStream();
|
||||||
|
|
||||||
void Sync();
|
void Sync();
|
||||||
|
@@ -104,7 +104,7 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size)
|
|||||||
// wxZlibOutputStream
|
// wxZlibOutputStream
|
||||||
//////////////////////
|
//////////////////////
|
||||||
|
|
||||||
wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream)
|
wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream, int level)
|
||||||
: wxFilterOutputStream(stream)
|
: wxFilterOutputStream(stream)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@@ -115,7 +115,10 @@ wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream)
|
|||||||
m_deflate->zfree = (free_func)0;
|
m_deflate->zfree = (free_func)0;
|
||||||
m_deflate->opaque = (voidpf)0;
|
m_deflate->opaque = (voidpf)0;
|
||||||
|
|
||||||
err = deflateInit(m_deflate, Z_DEFAULT_COMPRESSION);
|
if (level == -1) level = Z_DEFAULT_COMPRESSION;
|
||||||
|
wxASSERT_MSG(level >= 0 && level <= 9, wxT("wxZlibOutputStream compression level must be between 0 and 9!"));
|
||||||
|
|
||||||
|
err = deflateInit(m_deflate, level);
|
||||||
if (err != Z_OK) {
|
if (err != Z_OK) {
|
||||||
deflateEnd(m_deflate);
|
deflateEnd(m_deflate);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user