From 623169a5c6cbad1ae6d8969f273f534cbd0c3fe4 Mon Sep 17 00:00:00 2001 From: drbrain Date: Wed, 15 Feb 2012 01:28:05 +0000 Subject: * ext/zlib/zlib.c (Init_zlib): Added Zlib::FIXED and Zlib::RLE strategies. * NEWS: Add note about the new Zlib constants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ NEWS | 3 +++ ext/zlib/zlib.c | 22 +++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8de5a73908..152a3335cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Feb 15 09:27:45 2012 Eric Hodel + + * ext/zlib/zlib.c (Init_zlib): Added Zlib::FIXED and Zlib::RLE + strategies. + * NEWS: Add note about the new Zlib constants. + Wed Feb 15 09:11:36 2012 Eric Hodel * ext/zlib/zlib.c: Improve documentation. [ruby-trunk - Bug #5948] diff --git a/NEWS b/NEWS index 116b34a2a3..36b8b5ee1d 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,9 @@ with all sufficient information, see the ChangeLog file. * Shellwords#shelljoin() accepts non-string objects in the given array, each of which is stringified using to_s. +* zlib + * Added support for the new deflate strategies Zlib::RLE and Zlib::FIXED. + === Language changes === Compatibility issues (excluding feature bug fixes) diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 32decbbc36..b95198554e 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1329,13 +1329,21 @@ rb_deflate_s_allocate(VALUE klass) * * Zlib::FILTERED:: * For data produced by a filter (or predictor). The effect of FILTERED is - * to force more Huffman coding and less string matching; it is somewhat + * to force more Huffman codes and less string matching; it is somewhat * intermediate between DEFAULT_STRATEGY and HUFFMAN_ONLY. Filtered data * consists mostly of small values with a somewhat random distribution. * + * Zlib::FIXED:: + * Prevents the use of dynamic Huffman codes, allowing for a simpler decoder + * for specialized applications. + * * Zlib::HUFFMAN_ONLY:: * Use Huffman encoding only (no string matching). * + * Zlib::RLE:: + * Designed to be almost as fast as HUFFMAN_ONLY, but give better + * compression for PNG image data. + * * == Examples * * === Basic @@ -4209,6 +4217,18 @@ Init_zlib() * * Which is an argument for Deflate.new and Deflate#params. */ rb_define_const(mZlib, "HUFFMAN_ONLY", INT2FIX(Z_HUFFMAN_ONLY)); +#ifdef Z_RLE + /* compression method 3 + * + * Which is an argument for Deflate.new and Deflate#params. */ + rb_define_const(mZlib, "RLE", INT2FIX(Z_RLE)); +#endif +#ifdef Z_FIXED + /* compression method 4 + * + * Which is an argument for Deflate.new and Deflate#params. */ + rb_define_const(mZlib, "FIXED", INT2FIX(Z_FIXED)); +#endif /* compression method 0 * * Which is an argument for Deflate.new and Deflate#params. */ -- cgit v1.2.3