changeset 6041:649926e9c1a8

(jka-compr-partial-uncompress): Make dd give you one more block than you think you need. (jka-compr-dd-blocksize): Change default value to 256.
author Richard M. Stallman <rms@gnu.org>
date Wed, 23 Feb 1994 16:18:10 +0000
parents 7988b8acd29f
children 5bffd741340e
files lisp/jka-compr.el
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/jka-compr.el	Wed Feb 23 08:39:25 1994 +0000
+++ b/lisp/jka-compr.el	Wed Feb 23 16:18:10 1994 +0000
@@ -2,7 +2,7 @@
 ;;; Copyright (C) 1993, 1994  Free Software Foundation, Inc.
 
 ;; Author: jka@ece.cmu.edu (Jay K. Adams)
-;; Version: 0.10
+;; Version: 0.11
 ;; Keywords: data
 
 ;;; Commentary: 
@@ -12,7 +12,7 @@
 ;;; I/O functions (including write-region and insert-file-contents) so
 ;;; that they automatically compress or uncompress a file if the file
 ;;; appears to need it (based on the extension of the file name).
-;;; Packages like Rmail, Vm, Gnus, and Info should be able to work
+;;; Packages like Rmail, VM, GNUS, and Info should be able to work
 ;;; with compressed files without modification.
 
 
@@ -225,7 +225,7 @@
   "/bin/dd")
 
 
-(defvar jka-compr-dd-blocksize 512)
+(defvar jka-compr-dd-blocksize 256)
 
 
 (defun jka-compr-partial-uncompress (prog message args infile beg len)
@@ -238,7 +238,6 @@
 	 (prefix (- beg (* skip jka-compr-dd-blocksize)))
 	 (count (and len (1+ (/ (+ len prefix) jka-compr-dd-blocksize))))
 	 (start (point))
-	 (end (and count (+ start (* count jka-compr-dd-blocksize))))
 	 (err-file (jka-compr-make-temp-name))
 	 (run-string (format "%s %s 2> %s | %s bs=%d skip=%d %s 2> /dev/null"
 			     prog
@@ -247,7 +246,10 @@
 			     jka-compr-dd-program
 			     jka-compr-dd-blocksize
 			     skip
-			     (if count (concat "count=" count) ""))))
+			     ;; dd seems to be unreliable about
+			     ;; providing the last block.  So, always
+			     ;; read one more than you think you need.
+			     (if count (concat "count=" (1+ count)) ""))))
 
     (unwind-protect
 	(or (memq (call-process jka-compr-shell
@@ -260,8 +262,8 @@
       (jka-compr-delete-temp-file err-file))
 
     (and
-     end
-     (delete-region (+ start prefix len) end))
+     len
+     (delete-region (+ start prefix len) (point)))
 
     (delete-region start (+ start prefix))))
 
@@ -677,7 +679,7 @@
   
 (defvar jka-compr-op-table
   (make-vector 127 0)
-  "Hash table of operations supported by jka-compr")
+  "Hash table of operations supported by jka-compr.")
 
 
 (defun jka-compr-intern-operation (op)