#<Zlib::BufError: buffer error>

require “zlib”

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

Work fine with ruby 1.8, and do not work in ruby 1.9
#<Zlib::BufError: buffer error>
what is wrong ?

Oleg.

Oleg I. wrote:

require “zlib”

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

Work fine with ruby 1.8, and do not work in ruby 1.9
#<Zlib::BufError: buffer error>
what is wrong ?

Oleg.

Sorry, I’ts my bug. Subject closed.

Thanks
Oleg.

Oleg I. wrote:

require “zlib”

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

Work fine with ruby 1.8, and do not work in ruby 1.9
#<Zlib::BufError: buffer error>
what is wrong ?

Oleg.

require “zlib”

def deflate(string)
zipper = Zlib::Deflate.new
data = zipper.deflate(“hello world”, Zlib::FINISH)
end

def inflate(string)
zstream = Zlib::Inflate.new
buf = zstream.inflate(string)
zstream.finish
zstream.close
buf
end

compressed = deflate(“hello world”)
p compressed

uncompressed = inflate(compressed)
puts uncompressed

$ ruby19 -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin8.11.1]

$ ruby19 r1test.rb
“x\x9C\xCBH\xCD\xC9\xC9W(\xCF/\xCAI\x01\x00\x1A\v\x04]”
hello world