diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-19 05:14:29 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-19 05:14:29 +0000 |
commit | d842fce66e99f008f1119c82693120569a82c107 (patch) | |
tree | 76685f0bda7f7d331e77f988235408e09db0fb0e | |
parent | 439575890301d6649797002bc5e0739b1be25328 (diff) |
* ext/zlib/{extconf.rb, zlib.c): crc32_combine and adler32_combine is
supported on Zlib 1.2.2.1, so check them for old zlib.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/zlib/extconf.rb | 3 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb index 53b971b189..499f55a046 100644 --- a/ext/zlib/extconf.rb +++ b/ext/zlib/extconf.rb @@ -56,6 +56,9 @@ if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and $defs.concat(defines.collect{|d|' -D'+d}) + have_func('crc32_combine', 'zlib.h') + have_func('adler32_combine', 'zlib.h') + create_makefile('zlib') end diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 4de4594df9..2b9921713b 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -318,6 +318,7 @@ rb_zlib_adler32(int argc, VALUE *argv, VALUE klass) return do_checksum(argc, argv, adler32); } +#ifdef HAVE_ADLER32_COMBINE /* * call-seq: Zlib.adler32_combine(adler1, adler2, len2) * @@ -332,6 +333,9 @@ rb_zlib_adler32_combine(VALUE klass, VALUE adler1, VALUE adler2, VALUE len2) return ULONG2NUM( adler32_combine(NUM2ULONG(adler1), NUM2ULONG(adler2), NUM2LONG(len2))); } +#else +#define rb_zlib_adler32_combine rb_f_notimplement +#endif /* * call-seq: Zlib.crc32(string, adler) @@ -348,6 +352,7 @@ rb_zlib_crc32(int argc, VALUE *argv, VALUE klass) return do_checksum(argc, argv, crc32); } +#ifdef HAVE_CRC32_COMBINE /* * call-seq: Zlib.crc32_combine(crc1, crc2, len2) * @@ -362,6 +367,9 @@ rb_zlib_crc32_combine(VALUE klass, VALUE crc1, VALUE crc2, VALUE len2) return ULONG2NUM( crc32_combine(NUM2ULONG(crc1), NUM2ULONG(crc2), NUM2LONG(len2))); } +#else +#define rb_zlib_crc32_combine rb_f_notimplement +#endif /* * Returns the table for calculating CRC checksum as an array. |