# HG changeset patch # User Richard M. Stallman # Date 772647041 0 # Node ID 31eb7a0e27635618825dc7c1ed4caa41711da7c3 # Parent d04a39ce4f1dd34ecc950789254ef51f4c03d41b (jka-compr-partial-uncompress): Handle the case where LEN reaches to or past the end of the data. diff -r d04a39ce4f1d -r 31eb7a0e2763 lisp/jka-compr.el --- a/lisp/jka-compr.el Sat Jun 25 23:48:04 1994 +0000 +++ b/lisp/jka-compr.el Sun Jun 26 16:10:41 1994 +0000 @@ -237,9 +237,7 @@ (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 @@ (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))))