lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
#   Writes the given number of uncompressed bytes into the compressed file.
# gzwrite returns the number of bytes actually written (0 in case of error).
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of bytes actually written (0 in case of error).
Writes the given number of uncompressed bytes into the compressed file . gzwrite returns the number of bytes actually written ( 0 in case of error ) .
def gzwrite(file,buf,len)
    s = file
    if s.nil? || (s.mode != 'w')
      return Z_STREAM_ERROR
    end
    s.stream.next_in = Bytef.new(buf)
    s.stream.avail_in = len
    while s.stream.avail_in != 0
      if s.stream.avail_out == 0
        s.stream.next_out = Bytef.new(s.outbuf)
        written = s.file.write(s.outbuf)
        if (written != Z_BUFSIZE)
          s.z_err = Z_ERRNO
          break
        end
        s.stream.avail_out = Z_BUFSIZE
      end
      s.in += s.stream.avail_in
      s.out += s.stream.avail_out
      s.z_err = deflate(s.stream, Z_NO_FLUSH)
      s.in -= s.stream.avail_in
      s.out -= s.stream.avail_out
      break if (s.z_err != Z_OK)
    end
    s.crc = crc32(s.crc, buf, len)
    return (len - s.stream.avail_in)
  end
def gzwrite ( file , buf , len ) s = file if s . nil? || ( s . mode != 'w' ) return Z_STREAM_ERROR end s . stream . next_in = Bytef . new ( buf ) s . stream . avail_in = len while s . stream . avail_in != 0 if s . stream . avail_out == 0 s . stream . next_out = Bytef . new ( s . outbuf ) written = s . file . write ( s . outbuf ) if ( written != Z_BUFSIZE ) s . z_err = Z_ERRNO break end s . stream . avail_out = Z_BUFSIZE end s . in += s . stream . avail_in s . out += s . stream . avail_out s . z_err = deflate ( s . stream , Z_NO_FLUSH ) s . in -= s . stream . avail_in s . out -= s . stream . avail_out break if ( s . z_err != Z_OK ) end s . crc = crc32 ( s . crc , buf , len ) return ( len - s . stream . avail_in ) end
Writes the given number of uncompressed bytes into the compressed file.
Writes the given number of uncompressed bytes into the compressed file .
file
<not_specific>
buf
<not_specific>
len
<not_specific>