streams-zlib.cpp revision 47d32690b154bab52ddbb67c744d8d5704638f89
/*
* IO layer : zlib streambuf
*
* Authors:
* Johan Ceuppens <jceuppen at easynet dot be>
*
* Copyright (C) 2004 Johan Ceuppens
*
* Released under GNU LGPL, read the file 'COPYING.LIB' for more information
*/
#include "streams-zlib.h"
namespace Inkscape {
/**
* ZlibBuffer
*/
{
}
int ZlibBuffer::allocate_buffers()
{
if (!eback()) {
return 1;
}
return 0;
}
{
return 1;
}
int ZlibBuffer::underflow()
{
if (eback() == 0 && allocate_buffers() == 0)
return EOF;
if (consume_and_inflate() == EOF)
return EOF;
return *(unsigned char *)gptr();
}
int ZlibBuffer::overflow(int c)
{
if (c == EOF)
return flush_output();
if (pbase() == 0 && allocate_buffers() == 0)
return EOF;
flush_output() == EOF)
return EOF;
putchar(c);
flush_output() == EOF)
return EOF;
return c;
}
{
}
{
return EOF;
else if (nbytes == 0)
return EOF;
return nbytes;
}
{
ret = 1;
}
delete [] buf;
return ret;
}
int ZlibBuffer::consume_and_inflate()
{
return do_consume_and_inflate(BUFSIZE_STREAM);
}
int ZlibBuffer::flush_output()
{
return 0;
return 0;
else
return EOF;
}
{
throw ZlibBufferException();
}
}
{
throw ZlibBufferException();
}
{
}
{
}
do {
}
if (ret == Z_STREAM_END) {
break;
}
break;
}
return gba;
}
{
}
{
_putsize);
return 1;
}
} // namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :