GNU bug report logs -
#55815
[PATCH] bindat: Improve str, strz documentation
Previous Next
Reported by: Richard Hansen <rhansen <at> rhansen.org>
Date: Mon, 6 Jun 2022 02:23:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#55815: [PATCH] bindat: Improve str, strz documentation
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 55815 <at> debbugs.gnu.org.
--
55815: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55815
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
> Date: Wed, 8 Jun 2022 00:16:51 -0400
> Cc: 55815 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
> From: Richard Hansen <rhansen <at> rhansen.org>
>
> On 6/7/22 12:30, Eli Zaretskii wrote:
> >> Right now all three of those are unibyte, but in a future patch I
> >> plan on changing the first to accept unibyte-convertible multibyte
> >> input strings.
> >
> > Not sure I understand: what do you mean by "unibyte-convertible
> > multibyte input strings", and how do they differ from the other kinds?
>
> I mean multibyte strings that do not contain characters that will cause string-to-unibyte to signal an error.
IOW, multibyte strings that contain only ASCII characters and
characters of the 'eight-bit' charset.
> > In any case, you say "unibyte input string" too many time, and that's
> > unnecessary.
>
> Done, see attached.
Thanks, installed.
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
X-Debbugs-CC: monnier <at> iro.umontreal.ca
* doc/lispref/processes.texi (Bindat Types): Expand the documentation
for the `str' and `strz' types to clarify expectations and explain
edge case behavior.
---
doc/lispref/processes.texi | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 668a577870..68621d32a8 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -3479,11 +3479,31 @@ Bindat Types
@var{bitlen} has to be a multiple of 8.
@item str @var{len}
-String of bytes of length @var{len}.
+String of length @var{len}. When packing, the first @var{len} bytes
+of the input string are copied to the packed output. If the input
+string is shorter than @var{len}, the remaining bytes are set to zero.
+The input string must be unibyte (@pxref{Text Representations}). When
+unpacking, any zero bytes in the packed input string will appear in
+the unpacked output.
@item strz &optional @var{len}
-Zero-terminated string of bytes, can be of arbitrary length or in a fixed-size
-field with length @var{len}.
+If @var{len} is not provided: Variable-length null-terminated string.
+When packing, the entire input string is copied to the packed output
+followed by a zero byte (null terminator). The input string must be
+unibyte (@pxref{Text Representations}) and must not contain any zero
+bytes. When unpacking, the resulting string contains all bytes up to
+(but excluding) the null terminator.
+
+If @var{len} is provided: @code{strz} behaves the same as @code{str}
+with one difference. When unpacking, the first zero byte (null
+terminator) encountered in the packed string and all subsequent bytes
+are excluded from the unpacked result.
+
+@quotation Caution
+The packed output will not be null-terminated unless the input string
+is shorter than @var{len} or it contains a zero byte within the first
+@var{len} bytes.
+@end quotation
@item vec @var{len} [@var{type}]
Vector of @var{len} elements. The type of the elements is given by
--
2.36.1
[0001-bindat-Improve-str-strz-documentation.patch (text/x-patch, attachment)]
This bug report was last modified 3 years and 37 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.