34 #ifdef FIX8_HAVE_ZLIB_H 
   38 #ifdef GZSTREAM_NAMESPACE 
   39 namespace GZSTREAM_NAMESPACE {
 
   50 gzstreambuf* gzstreambuf::open(
const char* name, 
int open_mode)
 
   56     if ((mode & std::ios::ate) || ((mode & std::ios::in) && (mode & std::ios::out)))
 
   58     char fmode[10], *fmodeptr = fmode;
 
   59     if (mode & std::ios::in)
 
   61     else if (mode & std::ios::app)
 
   63     else if (mode & std::ios::out)
 
   67     if ((file = gzopen( name, fmode)) == 0)
 
   73 gzstreambuf *gzstreambuf::close()
 
   79         if (gzclose( file) == Z_OK)
 
   85 int gzstreambuf::underflow()
 
   87     if (gptr() && (gptr() < egptr()))
 
   88         return * 
reinterpret_cast<unsigned char *
>(gptr());
 
   90     if (! (mode & std::ios::in) || !opened)
 
   93     int n_putback = gptr() - eback();
 
   96     memcpy(buffer + (4 - n_putback), gptr() - n_putback, n_putback);
 
   98     int num = gzread( file, buffer+4, bufferSize-4);
 
  103     setg( buffer + (4 - n_putback),   
 
  108     return * 
reinterpret_cast<unsigned char *
>( gptr());
 
  111 int gzstreambuf::flush_buffer()
 
  115     int w = pptr() - pbase();
 
  116     if (gzwrite( file, pbase(), w) != w)
 
  122 int gzstreambuf::overflow(
int c)
 
  124     if ( !(mode & std::ios::out) || !opened)
 
  131     if (flush_buffer() == EOF)
 
  136 int gzstreambuf::sync()
 
  141     if (pptr() && pptr() > pbase())
 
  143         if (flush_buffer() == EOF)
 
  153 gzstreambase::gzstreambase(
const char* name, 
int mode)
 
  159 gzstreambase::~gzstreambase()
 
  164 void gzstreambase::open(
const char* name, 
int open_mode)
 
  166     if (!buf.open( name, open_mode))
 
  167         clear(rdstate() | std::ios::badbit);
 
  172 void gzstreambase::close()
 
  176             clear( rdstate() | std::ios::badbit);
 
  179 #ifdef GZSTREAM_NAMESPACE 
  182 #endif // FIX8_HAVE_ZLIB_H