summaryrefslogtreecommitdiff
path: root/lisp/jka-compr.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-06-26 16:10:41 +0000
committerRichard M. Stallman <rms@gnu.org>1994-06-26 16:10:41 +0000
commit3b01a9faa8b7cc405ca0f3cbc21d9183cde0990c (patch)
tree3f317fc4e3d2ab66b3df59ee5f0c24ee4706e598 /lisp/jka-compr.el
parentd4d0bddff68aa0d06370bf08bbfc925c5991acd0 (diff)
downloademacs-3b01a9faa8b7cc405ca0f3cbc21d9183cde0990c.tar.gz
(jka-compr-partial-uncompress): Handle the case where
LEN reaches to or past the end of the data.
Diffstat (limited to 'lisp/jka-compr.el')
-rw-r--r--lisp/jka-compr.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 0b3b60dc056..3247042eb7e 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -237,9 +237,7 @@ based on the filename itself and `jka-compr-compression-info-list'."
(defun jka-compr-partial-uncompress (prog message args infile beg len)
"Call program PROG with ARGS args taking input from INFILE.
Fourth and fifth args, BEG and LEN, specify which part of the output
-to discard. All output is discarded unless it comes within LEN chars after
-the BEGth char."
-
+to keep: LEN chars starting BEG chars from the beginning."
(let* ((skip (/ beg jka-compr-dd-blocksize))
(prefix (- beg (* skip jka-compr-dd-blocksize)))
(count (and len (1+ (/ (+ len prefix) jka-compr-dd-blocksize))))
@@ -267,10 +265,13 @@ the BEGth char."
(jka-compr-delete-temp-file err-file))
+ ;; Delete the stuff after what we want, if there is any.
(and
len
+ (< (+ start prefix len) (point))
(delete-region (+ start prefix len) (point)))
+ ;; Delete the stuff before what we want.
(delete-region start (+ start prefix))))