FACT++  1.0
int izstream::underflow ( )
inlineprivate

Definition at line 23 of file izstream.h.

References is_open().

24  {
25  if (gptr() && gptr()<egptr())
26  return * reinterpret_cast<unsigned char *>(gptr());
27 
28  if (!is_open())
29  return EOF;
30 
31  // gptr()-eback(): if more than four bytes are already flushed
32  const int iputback = gptr()-eback()>4 ? 4 : gptr()-eback();
33 
34  // Copy the last four bytes flushed into the putback area
35  memcpy(fBuffer+(4-iputback), gptr()-iputback, iputback);
36 
37  // Fill the buffer starting at the current file position and reset buffer
38  // pointers by calling setg
39  const int num = gzread(fFile, fBuffer+4, fgBufferSize-4);
40  if (num <= 0) // ERROR or EOF
41  return EOF;
42 
43  // reset buffer pointers
44  setg(fBuffer+(4-iputback), fBuffer+4, fBuffer+4+num);
45 
46  // return next character
47  return *reinterpret_cast<unsigned char *>(gptr());
48  }
int is_open()
Definition: izstream.h:65
static const int fgBufferSize
Definition: izstream.h:18
char * fBuffer
Definition: izstream.h:21
gzFile fFile
Definition: izstream.h:20

+ Here is the call graph for this function: