diff options
author | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2013-08-12 19:02:31 +0200 |
---|---|---|
committer | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2013-08-12 19:02:31 +0200 |
commit | 7699d09ec6f13ec0b864e82a8c59e56037628539 (patch) | |
tree | fa5d8707c5d41a71b16642e2dbf35010fd009092 /src/decompress.c | |
parent | 1d238bc75ac833eb28a72f24cc1acd79ec5999d7 (diff) | |
download | emacs-7699d09ec6f13ec0b864e82a8c59e56037628539.tar.gz |
Rename `zlib-decompress-gzipped-region' to `zlib-decompress-region'.
Also support zlib-format compression.
Diffstat (limited to 'src/decompress.c')
-rw-r--r-- | src/decompress.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/decompress.c b/src/decompress.c index 4e4e3a9c7dc..b3ad4f7676a 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -119,10 +119,10 @@ DEFUN ("zlib-available-p", Fzlib_available_p, Szlib_available_p, 0, 0, 0, #endif } -DEFUN ("zlib-decompress-gzipped-region", Fzlib_decompress_gzipped_region, - Szlib_decompress_gzipped_region, +DEFUN ("zlib-decompress-region", Fzlib_decompress_region, + Szlib_decompress_region, 2, 2, 0, - doc: /* Decompress a gzip-compressed region. + doc: /* Decompress a gzip- or zlib-compressed region. Replace the text in the region by the decompressed data. On failure, return nil and leave the data in place. This function can be called only in unibyte buffers. */) @@ -151,8 +151,9 @@ This function can be called only in unibyte buffers. */) stream.avail_in = 0; stream.next_in = Z_NULL; - /* This magic number apparently means "this is gzip". */ - if (fn_inflateInit2 (&stream, 16 + MAX_WBITS) != Z_OK) + /* The magic number 32 apparently means "autodect both the gzip and + zlib formats" according to zlib.h. */ + if (fn_inflateInit2 (&stream, MAX_WBITS + 32) != Z_OK) return Qnil; unwind_data.start = iend; @@ -210,7 +211,7 @@ void syms_of_decompress (void) { DEFSYM (Qzlib_dll, "zlib"); - defsubr (&Szlib_decompress_gzipped_region); + defsubr (&Szlib_decompress_region); defsubr (&Szlib_available_p); } |