emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113800: Fix decompress gap handling bug


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] trunk r113800: Fix decompress gap handling bug
Date: Sun, 11 Aug 2013 20:51:50 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113800
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Sun 2013-08-11 22:51:47 +0200
message:
  Fix decompress gap handling bug
  
  * decompress.c (Fdecompress_gzipped_region): Respect all zlib
  errors, and really move the gap to where we want it.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/decompress.c               decompress.c-20130811194033-wfhl0tqmmc36jfmu-1
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-11 19:43:36 +0000
+++ b/src/ChangeLog     2013-08-11 20:51:47 +0000
@@ -1,5 +1,8 @@
 2013-08-11  Lars Magne Ingebrigtsen  <address@hidden>
 
+       * decompress.c (Fdecompress_gzipped_region): Respect all zlib
+       errors, and really move the gap to where we want it.
+
        * lisp.h: Include decompress.c support.
 
        * emacs.c (main): Include decompress.c support.

=== modified file 'src/decompress.c'
--- a/src/decompress.c  2013-08-11 19:43:36 +0000
+++ b/src/decompress.c  2013-08-11 20:51:47 +0000
@@ -63,7 +63,6 @@
   ptrdiff_t count = SPECPDL_INDEX ();
 
   validate_region (&start, &end);
-  move_gap_both (iend, iend);
 
   if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
     error ("This function can only be called in unibyte buffers");
@@ -72,6 +71,7 @@
      the same. */
   istart = XINT (start);
   iend = XINT (end);
+  move_gap_both (iend, iend);
 
   stream.zalloc = Z_NULL;
   stream.zfree = Z_NULL;
@@ -99,13 +99,11 @@
 
   /* Run inflate() on input until the output buffer isn't full. */
   do {
+    int result;
     stream.avail_out = BUFFER_SIZE;
     stream.next_out = out;
-    switch (inflate (&stream, Z_NO_FLUSH)) {
-    case Z_STREAM_ERROR:
-    case Z_NEED_DICT:
-    case Z_DATA_ERROR:
-    case Z_MEM_ERROR:
+    result = inflate (&stream, Z_NO_FLUSH);
+    if (result < 0) {
       unbind_to (count, Qnil);
       return Qnil;
     }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]