aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/arc-mode.el47
1 files changed, 22 insertions, 25 deletions
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 1c88f9a1a18..871395ebb48 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -517,9 +517,6 @@ Each descriptor is a vector of the form
517;;; Section: Support functions. 517;;; Section: Support functions.
518 518
519(eval-when-compile 519(eval-when-compile
520 (defsubst byte-after (pos)
521 "Like char-after but an eight-bit char is converted to unibyte."
522 (multibyte-char-to-unibyte (char-after pos)))
523 (defsubst insert-unibyte (&rest args) 520 (defsubst insert-unibyte (&rest args)
524 "Like insert but don't make unibyte string and eight-bit char multibyte." 521 "Like insert but don't make unibyte string and eight-bit char multibyte."
525 (dolist (elt args) 522 (dolist (elt args)
@@ -1492,8 +1489,8 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1492 files 1489 files
1493 visual) 1490 visual)
1494 (while (and (< (+ p 29) (point-max)) 1491 (while (and (< (+ p 29) (point-max))
1495 (= (byte-after p) ?\C-z) 1492 (= (get-byte p) ?\C-z)
1496 (> (byte-after (1+ p)) 0)) 1493 (> (get-byte (1+ p)) 0))
1497 (let* ((namefld (buffer-substring (+ p 2) (+ p 2 13))) 1494 (let* ((namefld (buffer-substring (+ p 2) (+ p 2 13)))
1498 (fnlen (or (string-match "\0" namefld) 13)) 1495 (fnlen (or (string-match "\0" namefld) 13))
1499 (efnname (decode-coding-string (substring namefld 0 fnlen) 1496 (efnname (decode-coding-string (substring namefld 0 fnlen)
@@ -1558,13 +1555,13 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1558 visual) 1555 visual)
1559 (while (progn (goto-char p) ;beginning of a base header. 1556 (while (progn (goto-char p) ;beginning of a base header.
1560 (looking-at "\\(.\\|\n\\)\\(.\\|\n\\)-l[hz][0-9ds]-")) 1557 (looking-at "\\(.\\|\n\\)\\(.\\|\n\\)-l[hz][0-9ds]-"))
1561 (let* ((hsize (byte-after p)) ;size of the base header (level 0 and 1) 1558 (let* ((hsize (get-byte p)) ;size of the base header (level 0 and 1)
1562 (csize (archive-l-e (+ p 7) 4)) ;size of a compressed file to follow (level 0 and 2), 1559 (csize (archive-l-e (+ p 7) 4)) ;size of a compressed file to follow (level 0 and 2),
1563 ;size of extended headers + the compressed file to follow (level 1). 1560 ;size of extended headers + the compressed file to follow (level 1).
1564 (ucsize (archive-l-e (+ p 11) 4)) ;size of an uncompressed file. 1561 (ucsize (archive-l-e (+ p 11) 4)) ;size of an uncompressed file.
1565 (time1 (archive-l-e (+ p 15) 2)) ;date/time (MSDOS format in level 0, 1 headers 1562 (time1 (archive-l-e (+ p 15) 2)) ;date/time (MSDOS format in level 0, 1 headers
1566 (time2 (archive-l-e (+ p 17) 2)) ;and UNIX format in level 2 header.) 1563 (time2 (archive-l-e (+ p 17) 2)) ;and UNIX format in level 2 header.)
1567 (hdrlvl (byte-after (+ p 20))) ;header level 1564 (hdrlvl (get-byte (+ p 20))) ;header level
1568 thsize ;total header size (base + extensions) 1565 thsize ;total header size (base + extensions)
1569 fnlen efnname osid fiddle ifnname width p2 1566 fnlen efnname osid fiddle ifnname width p2
1570 neh ;beginning of next extension header (level 1 and 2) 1567 neh ;beginning of next extension header (level 1 and 2)
@@ -1572,7 +1569,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1572 gname uname modtime moddate) 1569 gname uname modtime moddate)
1573 (if (= hdrlvl 3) (error "can't handle lzh level 3 header type")) 1570 (if (= hdrlvl 3) (error "can't handle lzh level 3 header type"))
1574 (when (or (= hdrlvl 0) (= hdrlvl 1)) 1571 (when (or (= hdrlvl 0) (= hdrlvl 1))
1575 (setq fnlen (byte-after (+ p 21))) ;filename length 1572 (setq fnlen (get-byte (+ p 21))) ;filename length
1576 (setq efnname (let ((str (buffer-substring (+ p 22) (+ p 22 fnlen)))) ;filename from offset 22 1573 (setq efnname (let ((str (buffer-substring (+ p 22) (+ p 22 fnlen)))) ;filename from offset 22
1577 (decode-coding-string 1574 (decode-coding-string
1578 str archive-file-name-coding-system))) 1575 str archive-file-name-coding-system)))
@@ -1583,19 +1580,19 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1583 (setq neh (+ p 24)))) ;specific to level 2 header 1580 (setq neh (+ p 24)))) ;specific to level 2 header
1584 (if neh ;if level 1 or 2 we expect extension headers to follow 1581 (if neh ;if level 1 or 2 we expect extension headers to follow
1585 (let* ((ehsize (archive-l-e neh 2)) ;size of the extension header 1582 (let* ((ehsize (archive-l-e neh 2)) ;size of the extension header
1586 (etype (byte-after (+ neh 2)))) ;extension type 1583 (etype (get-byte (+ neh 2)))) ;extension type
1587 (while (not (= ehsize 0)) 1584 (while (not (= ehsize 0))
1588 (cond 1585 (cond
1589 ((= etype 1) ;file name 1586 ((= etype 1) ;file name
1590 (let ((i (+ neh 3))) 1587 (let ((i (+ neh 3)))
1591 (while (< i (+ neh ehsize)) 1588 (while (< i (+ neh ehsize))
1592 (setq efnname (concat efnname (char-to-string (byte-after i)))) 1589 (setq efnname (concat efnname (char-to-string (get-byte i))))
1593 (setq i (1+ i))))) 1590 (setq i (1+ i)))))
1594 ((= etype 2) ;directory name 1591 ((= etype 2) ;directory name
1595 (let ((i (+ neh 3))) 1592 (let ((i (+ neh 3)))
1596 (while (< i (+ neh ehsize)) 1593 (while (< i (+ neh ehsize))
1597 (setq dir (concat dir 1594 (setq dir (concat dir
1598 (if (= (byte-after i) 1595 (if (= (get-byte i)
1599 255) 1596 255)
1600 "/" 1597 "/"
1601 (char-to-string 1598 (char-to-string
@@ -1619,7 +1616,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1619 ) 1616 )
1620 (setq neh (+ neh ehsize)) 1617 (setq neh (+ neh ehsize))
1621 (setq ehsize (archive-l-e neh 2)) 1618 (setq ehsize (archive-l-e neh 2))
1622 (setq etype (byte-after (+ neh 2)))) 1619 (setq etype (get-byte (+ neh 2))))
1623 ;;get total header size for level 1 and 2 headers 1620 ;;get total header size for level 1 and 2 headers
1624 (setq thsize (- neh p)))) 1621 (setq thsize (- neh p))))
1625 (if (= hdrlvl 0) ;total header size 1622 (if (= hdrlvl 0) ;total header size
@@ -1706,7 +1703,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1706 (let ((sum 0)) 1703 (let ((sum 0))
1707 (while (> count 0) 1704 (while (> count 0)
1708 (setq count (1- count) 1705 (setq count (1- count)
1709 sum (+ sum (byte-after p)) 1706 sum (+ sum (get-byte p))
1710 p (1+ p))) 1707 p (1+ p)))
1711 (logand sum 255))) 1708 (logand sum 255)))
1712 1709
@@ -1715,8 +1712,8 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1715 (save-excursion 1712 (save-excursion
1716 (widen) 1713 (widen)
1717 (let* ((p (+ archive-proper-file-start (aref descr 4))) 1714 (let* ((p (+ archive-proper-file-start (aref descr 4)))
1718 (oldhsize (byte-after p)) 1715 (oldhsize (get-byte p))
1719 (oldfnlen (byte-after (+ p 21))) 1716 (oldfnlen (get-byte (+ p 21)))
1720 (newfnlen (length newname)) 1717 (newfnlen (length newname))
1721 (newhsize (+ oldhsize newfnlen (- oldfnlen))) 1718 (newhsize (+ oldhsize newfnlen (- oldfnlen)))
1722 (inhibit-read-only t)) 1719 (inhibit-read-only t))
@@ -1735,10 +1732,10 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1735 (widen) 1732 (widen)
1736 (dolist (fil files) 1733 (dolist (fil files)
1737 (let* ((p (+ archive-proper-file-start (aref fil 4))) 1734 (let* ((p (+ archive-proper-file-start (aref fil 4)))
1738 (hsize (byte-after p)) 1735 (hsize (get-byte p))
1739 (fnlen (byte-after (+ p 21))) 1736 (fnlen (get-byte (+ p 21)))
1740 (p2 (+ p 22 fnlen)) 1737 (p2 (+ p 22 fnlen))
1741 (creator (if (>= (- hsize fnlen) 24) (byte-after (+ p2 2)) 0)) 1738 (creator (if (>= (- hsize fnlen) 24) (get-byte (+ p2 2)) 0))
1742 (inhibit-read-only t)) 1739 (inhibit-read-only t))
1743 (if (= creator ?U) 1740 (if (= creator ?U)
1744 (progn 1741 (progn
@@ -1821,7 +1818,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1821 (setq p (archive-l-e (+ p 48) 8))) 1818 (setq p (archive-l-e (+ p 48) 8)))
1822 (setq p (+ p (point-min))) 1819 (setq p (+ p (point-min)))
1823 (while (string= "PK\001\002" (buffer-substring p (+ p 4))) 1820 (while (string= "PK\001\002" (buffer-substring p (+ p 4)))
1824 (let* ((creator (byte-after (+ p 5))) 1821 (let* ((creator (get-byte (+ p 5)))
1825 ;; (method (archive-l-e (+ p 10) 2)) 1822 ;; (method (archive-l-e (+ p 10) 2))
1826 (modtime (archive-l-e (+ p 12) 2)) 1823 (modtime (archive-l-e (+ p 12) 2))
1827 (moddate (archive-l-e (+ p 14) 2)) 1824 (moddate (archive-l-e (+ p 14) 2))
@@ -1841,7 +1838,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1841 (logior ?\444 1838 (logior ?\444
1842 (if isdir (logior 16384 ?\111) 0) 1839 (if isdir (logior 16384 ?\111) 0)
1843 (if (zerop 1840 (if (zerop
1844 (logand 1 (byte-after (+ p 38)))) 1841 (logand 1 (get-byte (+ p 38))))
1845 ?\222 0))) 1842 ?\222 0)))
1846 (t nil))) 1843 (t nil)))
1847 (modestr (if mode (archive-int-to-mode mode) "??????????")) 1844 (modestr (if mode (archive-int-to-mode mode) "??????????"))
@@ -1918,7 +1915,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1918 (widen) 1915 (widen)
1919 (dolist (fil files) 1916 (dolist (fil files)
1920 (let* ((p (+ archive-proper-file-start (car (aref fil 4)))) 1917 (let* ((p (+ archive-proper-file-start (car (aref fil 4))))
1921 (creator (byte-after (+ p 5))) 1918 (creator (get-byte (+ p 5)))
1922 (oldmode (aref fil 3)) 1919 (oldmode (aref fil 3))
1923 (newval (archive-calc-mode oldmode newmode t)) 1920 (newval (archive-calc-mode oldmode newmode t))
1924 (inhibit-read-only t)) 1921 (inhibit-read-only t))
@@ -1928,7 +1925,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1928 (insert-unibyte (logand newval 255) (ash newval -8))) 1925 (insert-unibyte (logand newval 255) (ash newval -8)))
1929 ((memq creator '(0 5 6 7 10 11 15)) ; Dos etc. 1926 ((memq creator '(0 5 6 7 10 11 15)) ; Dos etc.
1930 (goto-char (+ p 38)) 1927 (goto-char (+ p 38))
1931 (insert-unibyte (logior (logand (byte-after (point)) 254) 1928 (insert-unibyte (logior (logand (get-byte (point)) 254)
1932 (logand (logxor 1 (ash newval -7)) 1))) 1929 (logand (logxor 1 (ash newval -7)) 1)))
1933 (delete-char 1)) 1930 (delete-char 1))
1934 (t (message "Don't know how to change mode for this member")))) 1931 (t (message "Don't know how to change mode for this member"))))
@@ -1949,9 +1946,9 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1949 (modtime (archive-l-e (+ p 16) 2)) 1946 (modtime (archive-l-e (+ p 16) 2))
1950 (ucsize (archive-l-e (+ p 20) 4)) 1947 (ucsize (archive-l-e (+ p 20) 4))
1951 (namefld (buffer-substring (+ p 38) (+ p 38 13))) 1948 (namefld (buffer-substring (+ p 38) (+ p 38 13)))
1952 (dirtype (byte-after (+ p 4))) 1949 (dirtype (get-byte (+ p 4)))
1953 (lfnlen (if (= dirtype 2) (byte-after (+ p 56)) 0)) 1950 (lfnlen (if (= dirtype 2) (get-byte (+ p 56)) 0))
1954 (ldirlen (if (= dirtype 2) (byte-after (+ p 57)) 0)) 1951 (ldirlen (if (= dirtype 2) (get-byte (+ p 57)) 0))
1955 (fnlen (or (string-match "\0" namefld) 13)) 1952 (fnlen (or (string-match "\0" namefld) 13))
1956 (efnname (let ((str 1953 (efnname (let ((str
1957 (concat 1954 (concat