From 8bbc2eecee419f60ede3d7582c075d6997f0ff8c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 28 May 2016 14:53:38 -0700 Subject: Use byte-oriented stream in binary editing utility. * txr-embedded-arg.txr (stream-positioned-to-right-place): Call stream-set-prop to mark stream as byte oriented. This is for the sake of the MinGW port, where reading binary files with UTF-8 decoding can throw errors about unsupported Unicode characters (those beyond 0xFFFF). --- txr-embedded-arg.txr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/txr-embedded-arg.txr b/txr-embedded-arg.txr index fb167508..584a8a6e 100755 --- a/txr-embedded-arg.txr +++ b/txr-embedded-arg.txr @@ -1,7 +1,8 @@ @(do (defun stream-positioned-to-right-place (name) (let* ((stream (open-file name "r+b")) - (pre (read-until-match #/@\(txr\)/ stream t))) + (pre (progn (stream-set-prop stream :byte-oriented t) + (read-until-match #/@\(txr\)/ stream t)))) (when (or (empty pre) (not (search-str pre "@(txr)"))) (throwf 'error "~a isn't a TXR executable" name)) stream))) -- cgit v1.2.3