From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: zip-mode mis-displays large files Date: Sat, 22 Apr 2006 16:19:54 +0300 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1145712022 20963 80.91.229.2 (22 Apr 2006 13:20:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Apr 2006 13:20:22 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 22 15:20:21 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FXI20-0000PB-Bh for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2006 15:20:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXI1z-0000TN-LE for ged-emacs-devel@m.gmane.org; Sat, 22 Apr 2006 09:20:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FXI1m-0000QD-F4 for emacs-devel@gnu.org; Sat, 22 Apr 2006 09:19:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FXI1k-0000Mn-EJ for emacs-devel@gnu.org; Sat, 22 Apr 2006 09:19:57 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXI1k-0000Mb-8f for emacs-devel@gnu.org; Sat, 22 Apr 2006 09:19:56 -0400 Original-Received: from [192.114.186.20] (helo=nitzan.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FXI3W-0005Kq-SC for emacs-devel@gnu.org; Sat, 22 Apr 2006 09:21:47 -0400 Original-Received: from HOME-C4E4A596F7 (IGLD-83-130-212-1.inter.net.il [83.130.212.1]) by nitzan.inter.net.il (MOS 3.7.3-GA) with ESMTP id DEJ39725 (AUTH halo1); Sat, 22 Apr 2006 16:19:53 +0300 (IDT) Original-To: sds@podval.org, emacs-devel@gnu.org In-reply-to: (message from Eli Zaretskii on Sat, 22 Apr 2006 15:00:10 +0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53232 Archived-At: > Date: Sat, 22 Apr 2006 15:00:10 +0300 > From: Eli Zaretskii > Cc: emacs-devel@gnu.org > > > note the negative length of the "no-match-18.log" file. > > Does the patch below give good results? Oops, I failed to remove left-overs from the initial (and unsuccessful) attack of the problem. Please try this patch instead: Index: lisp/arc-mode.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/arc-mode.el,v retrieving revision 1.72 diff -u -r1.72 arc-mode.el --- lisp/arc-mode.el 8 Mar 2006 01:57:59 -0000 1.72 +++ lisp/arc-mode.el 22 Apr 2006 11:57:42 -0000 @@ -464,10 +464,12 @@ (defsubst archive-name (suffix) (intern (concat "archive-" (symbol-name archive-subtype) "-" suffix))) -(defun archive-l-e (str &optional len) +(defun archive-l-e (str &optional len float) "Convert little endian string/vector STR to integer. Alternatively, STR may be a buffer position in the current buffer -in which case a second argument, length LEN, should be supplied." +in which case a second argument, length LEN, should be supplied. +FLOAT, if non-nil, means generate and return a float instead of an integer +\(use this for numbers that can overflow the Emacs integer)." (if (stringp str) (setq len (length str)) (setq str (buffer-substring str (+ str len)))) @@ -475,7 +477,8 @@ (i 0)) (while (< i len) (setq i (1+ i) - result (+ (ash result 8) (aref str (- len i))))) + result (+ (if float (* result 256.0) (ash result 8)) + (aref str (- len i))))) result)) (defun archive-int-to-mode (mode) @@ -1331,13 +1334,13 @@ (let* ((namefld (buffer-substring (+ p 2) (+ p 2 13))) (fnlen (or (string-match "\0" namefld) 13)) (efnname (substring namefld 0 fnlen)) - (csize (archive-l-e (+ p 15) 4)) + (csize (archive-l-e (+ p 15) 4 'float)) (moddate (archive-l-e (+ p 19) 2)) (modtime (archive-l-e (+ p 21) 2)) - (ucsize (archive-l-e (+ p 25) 4)) + (ucsize (archive-l-e (+ p 25) 4 'float)) (fiddle (string= efnname (upcase efnname))) (ifnname (if fiddle (downcase efnname) efnname)) - (text (format " %8d %-11s %-8s %s" + (text (format " %8.0f %-11s %-8s %s" ucsize (archive-dosdate moddate) (archive-dostime modtime) @@ -1359,7 +1362,7 @@ dash) (archive-summarize-files (nreverse visual)) (insert dash - (format " %8d %d file%s" + (format " %8.0f %d file%s" totalsize (length files) (if (= 1 (length files)) "" "s")) @@ -1393,9 +1396,9 @@ (while (progn (goto-char p) ;beginning of a base header. (looking-at "\\(.\\|\n\\)\\(.\\|\n\\)-l[hz][0-9ds]-")) (let* ((hsize (char-after p)) ;size of the base header (level 0 and 1) - (csize (archive-l-e (+ p 7) 4)) ;size of a compressed file to follow (level 0 and 2), + (csize (archive-l-e (+ p 7) 4 'float)) ;size of a compressed file to follow (level 0 and 2), ;size of extended headers + the compressed file to follow (level 1). - (ucsize (archive-l-e (+ p 11) 4)) ;size of an uncompressed file. + (ucsize (archive-l-e (+ p 11) 4 'float)) ;size of an uncompressed file. (time1 (archive-l-e (+ p 15) 2)) ;date/time (MSDOS format in level 0, 1 headers (time2 (archive-l-e (+ p 17) 2)) ;and UNIX format in level 2 header.) (hdrlvl (char-after (+ p 20))) ;header level @@ -1471,12 +1474,12 @@ (archive-unixtime time1 time2) (archive-dostime time1))) (setq text (if archive-alternate-display - (format " %8d %5S %5S %s" + (format " %8.0f %5S %5S %s" ucsize (or uid "?") (or gid "?") ifnname) - (format " %10s %8d %-11s %-8s %s" + (format " %10s %8.0f %-11s %-8s %s" modestr ucsize moddate @@ -1506,8 +1509,8 @@ "M Length Uid Gid File\n" "M Filemode Length Date Time File\n")) (sumline (if archive-alternate-display - " %8d %d file%s" - " %8d %d file%s"))) + " %8.0f %d file%s" + " %8.0f %d file%s"))) (insert header dash) (archive-summarize-files (nreverse visual)) (insert dash @@ -1603,7 +1606,7 @@ ;; (method (archive-l-e (+ p 10) 2)) (modtime (archive-l-e (+ p 12) 2)) (moddate (archive-l-e (+ p 14) 2)) - (ucsize (archive-l-e (+ p 24) 4)) + (ucsize (archive-l-e (+ p 24) 4 'float)) (fnlen (archive-l-e (+ p 28) 2)) (exlen (archive-l-e (+ p 30) 2)) (fclen (archive-l-e (+ p 32) 2)) @@ -1629,7 +1632,7 @@ (string= (upcase efnname) efnname))) (ifnname (if fiddle (downcase efnname) efnname)) (width (string-width ifnname)) - (text (format " %10s %8d %-11s %-8s %s" + (text (format " %10s %8.0f %-11s %-8s %s" modestr ucsize (archive-dosdate moddate) @@ -1655,7 +1658,7 @@ dash) (archive-summarize-files (nreverse visual)) (insert dash - (format " %8d %d file%s" + (format " %8.0f %d file%s" totalsize (length files) (if (= 1 (length files)) "" "s")) @@ -1709,7 +1712,7 @@ (let* ((next (1+ (archive-l-e (+ p 6) 4))) (moddate (archive-l-e (+ p 14) 2)) (modtime (archive-l-e (+ p 16) 2)) - (ucsize (archive-l-e (+ p 20) 4)) + (ucsize (archive-l-e (+ p 20) 4 'float)) (namefld (buffer-substring (+ p 38) (+ p 38 13))) (dirtype (char-after (+ p 4))) (lfnlen (if (= dirtype 2) (char-after (+ p 56)) 0)) @@ -1733,7 +1736,7 @@ (fiddle (and (= lfnlen 0) (string= efnname (upcase efnname)))) (ifnname (if fiddle (downcase efnname) efnname)) (width (string-width ifnname)) - (text (format " %8d %-11s %-8s %s" + (text (format " %8.0f %-11s %-8s %s" ucsize (archive-dosdate moddate) (archive-dostime modtime) @@ -1755,7 +1758,7 @@ dash) (archive-summarize-files (nreverse visual)) (insert dash - (format " %8d %d file%s" + (format " %8.0f %d file%s" totalsize (length files) (if (= 1 (length files)) "" "s"))