提交 6be630b9 编写于 作者: B Benjamin Kaduk 提交者: Rich Salz

Clarify the behavior of BIO_gets() a bit more

The API contract is more tight than was previously documented -- the returned
string must be NUL-terminated, and the supplied buffer includes space for
the trailing NUL, so the maximum length that can be read in is reduced.

Clarify that the NUL is not included in the returned length, and fix the
spelling of "NUL-terminated" in a nearby spot.

Adjust punctuation to make a modest improvement to the grammar.
Reviewed-by: NMatt Caswell <matt@openssl.org>
Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 b6ca88ab
...@@ -20,20 +20,22 @@ the data in B<buf>. ...@@ -20,20 +20,22 @@ the data in B<buf>.
BIO_gets() performs the BIOs "gets" operation and places the data BIO_gets() performs the BIOs "gets" operation and places the data
in B<buf>. Usually this operation will attempt to read a line of data in B<buf>. Usually this operation will attempt to read a line of data
from the BIO of maximum length B<len>. There are exceptions to this from the BIO of maximum length B<len-1>. There are exceptions to this,
however, for example BIO_gets() on a digest BIO will calculate and however; for example, BIO_gets() on a digest BIO will calculate and
return the digest and other BIOs may not support BIO_gets() at all. return the digest and other BIOs may not support BIO_gets() at all.
The returned string is always NUL-terminated.
BIO_write() attempts to write B<len> bytes from B<buf> to BIO B<b>. BIO_write() attempts to write B<len> bytes from B<buf> to BIO B<b>.
BIO_puts() attempts to write a null terminated string B<buf> to BIO B<b>. BIO_puts() attempts to write a NUL-terminated string B<buf> to BIO B<b>.
=head1 RETURN VALUES =head1 RETURN VALUES
All these functions return either the amount of data successfully read or All these functions return either the amount of data successfully read or
written (if the return value is positive) or that no data was successfully written (if the return value is positive) or that no data was successfully
read or written if the result is 0 or -1. If the return value is -2 then read or written if the result is 0 or -1. If the return value is -2 then
the operation is not implemented in the specific BIO type. the operation is not implemented in the specific BIO type. The trailing
NUL is not included in the length returned by BIO_gets().
=head1 NOTES =head1 NOTES
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册