lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
#   Flushes all pending output into the compressed file. The parameter
# flush is as in the deflate() function.
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function.
Flushes all pending output into the compressed file . The parameter flush is as in the deflate () function .
def do_flush(file,flush)
    done = false
    s = file
    if (s.nil?) || (s.mode != 'w')
      return Z_STREAM_ERROR
    end
    s.stream.avail_in = 0
    loop do
      len = Z_BUFSIZE - s.stream.avail_out
      if len != 0
        written = s.file.write(s.outbuf[0,len])
        if (written != len)
          s.z_err = Z_ERRNO
          return Z_ERRNO
        end
        s.stream.next_out = Bytef.new(s.outbuf)
        s.stream.avail_out = Z_BUFSIZE
      end
      break if (done)
      s.out += s.stream.avail_out
      s.z_err = deflate(s.stream, flush)
      s.out -= s.stream.avail_out
      if len == 0 && (s.z_err == Z_BUF_ERROR)
        s.z_err = Z_OK
      end
      done = s.stream.avail_out != 0 || (s.z_err == Z_STREAM_END)
      break if (s.z_err != Z_OK) && (s.z_err != Z_STREAM_END)
    end
    if (s.z_err = Z_STREAM_END)
      return Z_OK
    else
      return s.z_err
    end
  end
def do_flush ( file , flush ) done = false s = file if ( s . nil? ) || ( s . mode != 'w' ) return Z_STREAM_ERROR end s . stream . avail_in = 0 loop do len = Z_BUFSIZE - s . stream . avail_out if len != 0 written = s . file . write ( s . outbuf [ 0 , len ] ) if ( written != len ) s . z_err = Z_ERRNO return Z_ERRNO end s . stream . next_out = Bytef . new ( s . outbuf ) s . stream . avail_out = Z_BUFSIZE end break if ( done ) s . out += s . stream . avail_out s . z_err = deflate ( s . stream , flush ) s . out -= s . stream . avail_out if len == 0 && ( s . z_err == Z_BUF_ERROR ) s . z_err = Z_OK end done = s . stream . avail_out != 0 || ( s . z_err == Z_STREAM_END ) break if ( s . z_err != Z_OK ) && ( s . z_err != Z_STREAM_END ) end if ( s . z_err = Z_STREAM_END ) return Z_OK else return s . z_err end end
Flushes all pending output into the compressed file.
Flushes all pending output into the compressed file .
file
<not_specific>
flush
<not_specific>