aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2013-08-12 19:02:31 +0200
committerLars Magne Ingebrigtsen2013-08-12 19:02:31 +0200
commit7699d09ec6f13ec0b864e82a8c59e56037628539 (patch)
treefa5d8707c5d41a71b16642e2dbf35010fd009092
parent1d238bc75ac833eb28a72f24cc1acd79ec5999d7 (diff)
downloademacs-7699d09ec6f13ec0b864e82a8c59e56037628539.tar.gz
emacs-7699d09ec6f13ec0b864e82a8c59e56037628539.zip
Rename `zlib-decompress-gzipped-region' to `zlib-decompress-region'.
Also support zlib-format compression.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/url/ChangeLog2
-rw-r--r--lisp/url/url-http.el4
-rw-r--r--lisp/url/url-vars.el3
-rw-r--r--src/ChangeLog5
-rw-r--r--src/decompress.c13
6 files changed, 20 insertions, 10 deletions
diff --git a/etc/NEWS b/etc/NEWS
index e37b107176c..715f7906073 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -43,7 +43,8 @@ no longer created during installation.
43 43
44** Emacs can be compiled with zlib support. If this library is present 44** Emacs can be compiled with zlib support. If this library is present
45(which it normally is on most systems), the function 45(which it normally is on most systems), the function
46`zlib-decompress-gzipped-region' becomes available. 46`zlib-decompress-region' becomes available, which can decompress gzip-
47and zlib-format compressed data.
47 48
48--- 49---
49** Emacs for NS (OSX, GNUStep) can be built with ImageMagick support. 50** Emacs for NS (OSX, GNUStep) can be built with ImageMagick support.
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 7ac445e03c1..2346803c6bf 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -3,6 +3,8 @@
3 * url-http.el (url-handle-content-transfer-encoding): Renamed 3 * url-http.el (url-handle-content-transfer-encoding): Renamed
4 `zlib-decompress-gzipped-region' and check whether it's available, 4 `zlib-decompress-gzipped-region' and check whether it's available,
5 too. 5 too.
6 (url-handle-content-transfer-encoding): Renamed
7 `zlib-decompress-region' again.
6 8
72013-08-11 Lars Magne Ingebrigtsen <larsi@gnus.org> 92013-08-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
8 10
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 9eab1a6f683..07049591cf0 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -860,14 +860,14 @@ should be shown to the user."
860(defun url-handle-content-transfer-encoding () 860(defun url-handle-content-transfer-encoding ()
861 (let ((encoding (mail-fetch-field "content-encoding"))) 861 (let ((encoding (mail-fetch-field "content-encoding")))
862 (when (and encoding 862 (when (and encoding
863 (fboundp 'zlib-decompress-gzipped-region) 863 (fboundp 'zlib-decompress-region)
864 (zlib-available-p) 864 (zlib-available-p)
865 (equal (downcase encoding) "gzip")) 865 (equal (downcase encoding) "gzip"))
866 (save-restriction 866 (save-restriction
867 (widen) 867 (widen)
868 (goto-char (point-min)) 868 (goto-char (point-min))
869 (when (search-forward "\n\n") 869 (when (search-forward "\n\n")
870 (zlib-decompress-gzipped-region (point) (point-max))))))) 870 (zlib-decompress-region (point) (point-max)))))))
871 871
872;; Miscellaneous 872;; Miscellaneous
873(defun url-http-activate-callback () 873(defun url-http-activate-callback ()
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index 786b5533bf8..0361e01dfb4 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -210,7 +210,8 @@ Should be an assoc list of headers/contents.")
210 210
211(defvar url-request-method nil "The method to use for the next request.") 211(defvar url-request-method nil "The method to use for the next request.")
212 212
213(defvar url-mime-encoding-string (and (fboundp 'zlib-decompress-gzipped-region) 213(defvar url-mime-encoding-string (and (fboundp 'zlib-decompress-region)
214 (zlib-available-p)
214 "gzip") 215 "gzip")
215 "String to send in the Accept-encoding: field in HTTP requests.") 216 "String to send in the Accept-encoding: field in HTTP requests.")
216 217
diff --git a/src/ChangeLog b/src/ChangeLog
index cf851d5bec0..88e1fdc4e66 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12013-08-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * decompress.c (Fzlib_decompress_region): Support zlib
4 decompression, too, and rename.
5
12013-08-12 Paul Eggert <eggert@cs.ucla.edu> 62013-08-12 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Minor zlib configuration tweaks. 8 Minor zlib configuration tweaks.
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,
119#endif 119#endif
120} 120}
121 121
122DEFUN ("zlib-decompress-gzipped-region", Fzlib_decompress_gzipped_region, 122DEFUN ("zlib-decompress-region", Fzlib_decompress_region,
123 Szlib_decompress_gzipped_region, 123 Szlib_decompress_region,
124 2, 2, 0, 124 2, 2, 0,
125 doc: /* Decompress a gzip-compressed region. 125 doc: /* Decompress a gzip- or zlib-compressed region.
126Replace the text in the region by the decompressed data. 126Replace the text in the region by the decompressed data.
127On failure, return nil and leave the data in place. 127On failure, return nil and leave the data in place.
128This function can be called only in unibyte buffers. */) 128This function can be called only in unibyte buffers. */)
@@ -151,8 +151,9 @@ This function can be called only in unibyte buffers. */)
151 stream.avail_in = 0; 151 stream.avail_in = 0;
152 stream.next_in = Z_NULL; 152 stream.next_in = Z_NULL;
153 153
154 /* This magic number apparently means "this is gzip". */ 154 /* The magic number 32 apparently means "autodect both the gzip and
155 if (fn_inflateInit2 (&stream, 16 + MAX_WBITS) != Z_OK) 155 zlib formats" according to zlib.h. */
156 if (fn_inflateInit2 (&stream, MAX_WBITS + 32) != Z_OK)
156 return Qnil; 157 return Qnil;
157 158
158 unwind_data.start = iend; 159 unwind_data.start = iend;
@@ -210,7 +211,7 @@ void
210syms_of_decompress (void) 211syms_of_decompress (void)
211{ 212{
212 DEFSYM (Qzlib_dll, "zlib"); 213 DEFSYM (Qzlib_dll, "zlib");
213 defsubr (&Szlib_decompress_gzipped_region); 214 defsubr (&Szlib_decompress_region);
214 defsubr (&Szlib_available_p); 215 defsubr (&Szlib_available_p);
215} 216}
216 217