-Optional third arg RAW-DATA is a pre-allocated string or vector to unpack into.
-Optional fourth arg POS is the starting offset into RAW-DATA.
-Note: The result is a multibyte string; use `string-make-unibyte' on it
-to make it unibyte if necessary."
- (let ((no-return raw-data))
- (unless pos (setq pos 0))
- (unless raw-data (setq raw-data (make-vector (+ pos (bindat-length spec struct)) 0)))
+Optional third arg BINDAT-RAW is a pre-allocated unibyte string or vector to
+pack into.
+Optional fourth arg BINDAT-IDX is the starting offset into BINDAT-RAW."
+ (when (multibyte-string-p bindat-raw)
+ (error "Pre-allocated string is multibyte"))
+ (let ((no-return bindat-raw))
+ (unless bindat-idx (setq bindat-idx 0))
+ (unless bindat-raw
+ (setq bindat-raw (make-vector (+ bindat-idx (bindat-length spec struct)) 0)))