Changeset 4079 for trunk/lisp/arc-mode.el
- Timestamp:
- 05/13/06 11:31:18 (3 years ago)
- Files:
-
- trunk/lisp/arc-mode.el (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/arc-mode.el
r4058 r4079 465 465 (intern (concat "archive-" (symbol-name archive-subtype) "-" suffix))) 466 466 467 (defun archive-l-e (str &optional len )467 (defun archive-l-e (str &optional len float) 468 468 "Convert little endian string/vector STR to integer. 469 469 Alternatively, STR may be a buffer position in the current buffer 470 in which case a second argument, length LEN, should be supplied." 470 in which case a second argument, length LEN, should be supplied. 471 FLOAT, if non-nil, means generate and return a float instead of an integer 472 \(use this for numbers that can overflow the Emacs integer)." 471 473 (if (stringp str) 472 474 (setq len (length str)) … … 476 478 (while (< i len) 477 479 (setq i (1+ i) 478 result (+ (ash result 8) (aref str (- len i))))) 480 result (+ (if float (* result 256.0) (ash result 8)) 481 (aref str (- len i))))) 479 482 result)) 480 483 … … 861 864 (save-excursion 862 865 (goto-char (point-min)) 863 (let ((coding 866 (let ((buffer-undo-list t) 867 (coding 864 868 (or coding-system-for-read 865 869 (and set-auto-coding-function … … 1332 1336 (fnlen (or (string-match "\0" namefld) 13)) 1333 1337 (efnname (substring namefld 0 fnlen)) 1334 (csize (archive-l-e (+ p 15) 4)) 1338 ;; Convert to float to avoid overflow for very large files. 1339 (csize (archive-l-e (+ p 15) 4 'float)) 1335 1340 (moddate (archive-l-e (+ p 19) 2)) 1336 1341 (modtime (archive-l-e (+ p 21) 2)) 1337 (ucsize (archive-l-e (+ p 25) 4 ))1342 (ucsize (archive-l-e (+ p 25) 4 'float)) 1338 1343 (fiddle (string= efnname (upcase efnname))) 1339 1344 (ifnname (if fiddle (downcase efnname) efnname)) 1340 (text (format " %8 d%-11s %-8s %s"1345 (text (format " %8.0f %-11s %-8s %s" 1341 1346 ucsize 1342 1347 (archive-dosdate moddate) … … 1360 1365 (archive-summarize-files (nreverse visual)) 1361 1366 (insert dash 1362 (format " %8 d%d file%s"1367 (format " %8.0f %d file%s" 1363 1368 totalsize 1364 1369 (length files) … … 1394 1399 (looking-at "\\(.\\|\n\\)\\(.\\|\n\\)-l[hz][0-9ds]-")) 1395 1400 (let* ((hsize (char-after p)) ;size of the base header (level 0 and 1) 1396 (csize (archive-l-e (+ p 7) 4)) ;size of a compressed file to follow (level 0 and 2), 1401 ;; Convert to float to avoid overflow for very large files. 1402 (csize (archive-l-e (+ p 7) 4 'float)) ;size of a compressed file to follow (level 0 and 2), 1397 1403 ;size of extended headers + the compressed file to follow (level 1). 1398 (ucsize (archive-l-e (+ p 11) 4 )) ;size of an uncompressed file.1404 (ucsize (archive-l-e (+ p 11) 4 'float)) ;size of an uncompressed file. 1399 1405 (time1 (archive-l-e (+ p 15) 2)) ;date/time (MSDOS format in level 0, 1 headers 1400 1406 (time2 (archive-l-e (+ p 17) 2)) ;and UNIX format in level 2 header.) … … 1472 1478 (archive-dostime time1))) 1473 1479 (setq text (if archive-alternate-display 1474 (format " %8 d%5S %5S %s"1480 (format " %8.0f %5S %5S %s" 1475 1481 ucsize 1476 1482 (or uid "?") 1477 1483 (or gid "?") 1478 1484 ifnname) 1479 (format " %10s %8 d%-11s %-8s %s"1485 (format " %10s %8.0f %-11s %-8s %s" 1480 1486 modestr 1481 1487 ucsize … … 1507 1513 "M Filemode Length Date Time File\n")) 1508 1514 (sumline (if archive-alternate-display 1509 " %8 d%d file%s"1510 " %8 d%d file%s")))1515 " %8.0f %d file%s" 1516 " %8.0f %d file%s"))) 1511 1517 (insert header dash) 1512 1518 (archive-summarize-files (nreverse visual)) … … 1604 1610 (modtime (archive-l-e (+ p 12) 2)) 1605 1611 (moddate (archive-l-e (+ p 14) 2)) 1606 (ucsize (archive-l-e (+ p 24) 4)) 1612 ;; Convert to float to avoid overflow for very large files. 1613 (ucsize (archive-l-e (+ p 24) 4 'float)) 1607 1614 (fnlen (archive-l-e (+ p 28) 2)) 1608 1615 (exlen (archive-l-e (+ p 30) 2)) … … 1630 1637 (ifnname (if fiddle (downcase efnname) efnname)) 1631 1638 (width (string-width ifnname)) 1632 (text (format " %10s %8 d%-11s %-8s %s"1639 (text (format " %10s %8.0f %-11s %-8s %s" 1633 1640 modestr 1634 1641 ucsize … … 1656 1663 (archive-summarize-files (nreverse visual)) 1657 1664 (insert dash 1658 (format " %8 d%d file%s"1665 (format " %8.0f %d file%s" 1659 1666 totalsize 1660 1667 (length files) … … 1710 1717 (moddate (archive-l-e (+ p 14) 2)) 1711 1718 (modtime (archive-l-e (+ p 16) 2)) 1712 (ucsize (archive-l-e (+ p 20) 4)) 1719 ;; Convert to float to avoid overflow for very large files. 1720 (ucsize (archive-l-e (+ p 20) 4 'float)) 1713 1721 (namefld (buffer-substring (+ p 38) (+ p 38 13))) 1714 1722 (dirtype (char-after (+ p 4))) … … 1734 1742 (ifnname (if fiddle (downcase efnname) efnname)) 1735 1743 (width (string-width ifnname)) 1736 (text (format " %8 d%-11s %-8s %s"1744 (text (format " %8.0f %-11s %-8s %s" 1737 1745 ucsize 1738 1746 (archive-dosdate moddate) … … 1756 1764 (archive-summarize-files (nreverse visual)) 1757 1765 (insert dash 1758 (format " %8 d%d file%s"1766 (format " %8.0f %d file%s" 1759 1767 totalsize 1760 1768 (length files)
