bindat (strz): Fix wrong-type-argument error when unpacking
* lisp/emacs-lisp/bindat.el (strz): Fix (wrong-type-argument number-or-marker-p nil) error when unpacking a strz with unspecified (variable) length. * test/lisp/emacs-lisp/bindat-tests.el (strz): Mark test as passing.
This commit is contained in:
parent
30ec4a7347
commit
5255fa452f
2 changed files with 2 additions and 3 deletions
|
@ -165,12 +165,12 @@
|
|||
(if (stringp s) s
|
||||
(apply #'unibyte-string s))))
|
||||
|
||||
(defun bindat--unpack-strz (len)
|
||||
(defun bindat--unpack-strz (&optional len)
|
||||
(let ((i 0) s)
|
||||
(while (and (if len (< i len) t) (/= (aref bindat-raw (+ bindat-idx i)) 0))
|
||||
(setq i (1+ i)))
|
||||
(setq s (substring bindat-raw bindat-idx (+ bindat-idx i)))
|
||||
(setq bindat-idx (+ bindat-idx len))
|
||||
(setq bindat-idx (+ bindat-idx (or len (1+ i))))
|
||||
(if (stringp s) s
|
||||
(apply #'unibyte-string s))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue