[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Towards a cleaner build: arc-mode
From: |
Eli Zaretskii |
Subject: |
Re: Towards a cleaner build: arc-mode |
Date: |
Sat, 18 May 2019 10:50:05 +0300 |
> From: Lars Ingebrigtsen <address@hidden>
> Cc: address@hidden
> Date: Sat, 18 May 2019 08:04:25 +0200
>
> There's one additional use of string-as-multibyte in arc-mode that I
> didn't notice before:
>
> (defun archive-l-e (str &optional len)
> "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."
> (if (stringp str)
> (setq len (length str))
> (setq str (buffer-substring str (+ str len))))
> (setq str (string-as-unibyte str))
> (let ((result 0)
> (i 0))
> (while (< i len)
> (setq i (1+ i)
> result (+ (ash result 8)
> (aref str (- len i)))))
> result))
I think using this instead of string-as-unibyte should be OK:
(if (multibyte-string-p str)
(setq str (encode-coding-string str 'utf-8-emacs-unix)))
What string-as-unibyte does is it makes a unibyte string with the same
bytes as the internal representation of STR, except for raw bytes,
which it converts to their external single-byte form. Encoding with
utf-8-emacs does the same.
- Re: Towards a cleaner build, (continued)
Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/17
- Re: Towards a cleaner build: arc-mode, Eli Zaretskii, 2019/05/17
- Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/17
- Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18
- Re: Towards a cleaner build: arc-mode, Eli Zaretskii, 2019/05/18
- Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18
- Re: Towards a cleaner build: arc-mode,
Eli Zaretskii <=
- Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18
Re: Towards a cleaner build: arc-mode, Eli Zaretskii, 2019/05/18
Re: Towards a cleaner build: arc-mode, Stefan Monnier, 2019/05/18
Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18
Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18
Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18
Re: Towards a cleaner build: arc-mode, Eli Zaretskii, 2019/05/18
Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18
Re: Towards a cleaner build: arc-mode, Eli Zaretskii, 2019/05/18
Re: Towards a cleaner build: arc-mode, Lars Ingebrigtsen, 2019/05/18