-
Notifications
You must be signed in to change notification settings - Fork 967
Clarify return values of vsnprintf-s-vsnprintf-s-vsnprintf-s-l-vsnwprintf-s-vsnwprintf-s-l #2349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Pulling upstream changes to master
…s-l.md Clarification of return values.
@definedrisk : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
@definedrisk - thanks for the contribution. I've been away at a conference. I'll take a look at this and get back to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for trying to clear this up. I wonder if we can do a little more to clear this up. What do you think of updating your change like this:
- If count is less than the number of characters of data, or is _TRUNCATE, as much of the string as will fit in buffer is written and the functions returns -1 without invoking the invalid parameter handler.
- If the storage required to store count characters of data and a terminating
NULL
exceeds sizeOfBuffer, the invalid parameter handler is invoked as described in Parameter Validation. If execution continues after the invalid parameter handler, these functions set buffer to an empty string, set errno to ERANGE, and return -1.
@definedrisk : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
@definedrisk : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
I think I wanted to highlight that there is a subtle difference between truncation with a full buffer and truncation caused by sending more than count characters of data...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates.
I believe the first statement is now incorrect. The invalid parameter isn't invoked if count == _TRUNCATE. We need the 'unless' part in there. Then the clarifying points that follow can flesh out the details. It'd also be good to put each condition on it's own line. When it's all together (as it unfortunately was in the original), it's hard to tease out the flow quickly. We should start most general and get more specific in with each following point about the behavior. Thanks for hanging in there with me on this.
@definedrisk : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
@definedrisk : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
I moved the second sentence of the first paragraph of Return Value section to the Remarks section as it is not directly related to return value, I thought it was better placed as a remark. If you disagree I will move back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was good to move the part of compliance and backward compatibility to the remarks section.
Thank you for making the docs better! People will benefit from the more complete explanation about what this function returns that you've worked out here.
Thank you, @definedrisk Really appreciate working with you on this. |
No description provided.