Changeset 11434


Ignore:
Timestamp:
07/18/11 09:57:05 (13 years ago)
Author:
tbretz
Message:
Removed the need of fill_buffer
Location:
trunk/Mars/mbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mbase/MZlib.cc

    r11424 r11434  
    8080// --------------------------------------------------------------------------
    8181//
    82 // Fill the buffer starting at the current file position and reset buffer
    83 // pointers by calling setg
    84 //
    85 int MZlib::fill_buffer(int iputback)
    86 {
    87     const int num = gzread(fFile, fBuffer+4, fgBufferSize-4);
    88     if (num <= 0) // ERROR or EOF
    89         return EOF;
    90 
    91     // reset buffer pointers
    92     setg(fBuffer+(4-iputback), fBuffer+4, fBuffer+4+num);
    93 
    94     return num;
    95 }
    96 
    97 // --------------------------------------------------------------------------
    98 //
    9982// Handle a buffer underflow (buffer went empty)
    10083//
     
    11396    memcpy(fBuffer+(4-iputback), gptr()-iputback, iputback);
    11497
    115     if (fill_buffer(iputback)==EOF)
     98    // Fill the buffer starting at the current file position and reset buffer
     99    // pointers by calling setg
     100    const int num = gzread(fFile, fBuffer+4, fgBufferSize-4);
     101    if (num <= 0) // ERROR or EOF
    116102        return EOF;
     103
     104    // reset buffer pointers
     105    setg(fBuffer+(4-iputback), fBuffer+4, fBuffer+4+num);
    117106
    118107    // return next character
     
    187176        return EOF;
    188177
    189     // Fill buffer
    190     if (fill_buffer()==EOF)
    191         return EOF;
     178    // Buffer is empty
     179    setg(fBuffer+4, fBuffer+4, fBuffer+4);
    192180
    193181    return pos;
  • trunk/Mars/mbase/MZlib.h

    r11433 r11434  
    2323
    2424    int underflow();
    25     int fill_buffer(int putback=0);
    2625
    2726public:
Note: See TracChangeset for help on using the changeset viewer.