-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adding Jsrt function JsCopyStringOneByte #3408
Adding Jsrt function JsCopyStringOneByte #3408
Conversation
@@ -679,5 +679,42 @@ CHAKRA_API | |||
_In_ JsPropertyIdRef propertyId, | |||
_Out_ bool *hasOwnProperty); | |||
|
|||
/// <summary> | |||
/// Write JS string value into char string buffer without a null terminator |
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.
Can you add some more details about the semantics of this API, specifically what happens if the codepoint being copied is not within the char range
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 had addressed that at https://github.com/Microsoft/ChakraCore/pull/3408/files#diff-ffd84896ce29f73bbba0ed9612cf37b2R699 unless you feel that is unclear?
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.
Ah yes, that's great. Also clarify that UTF16 encoded codepoints are being truncated in this case. Actually, what happens in the case of a surrogate pair?
For scenarios where a string is known to have values fitting in one byte, this method allows directly copying those values into a char* buffer rather than having to copy to a uint16_t* buffer and then to a char* buffer, and treating the string as raw bytes rather than a valid utf8 encoding.
1a36fd6
to
9020556
Compare
Merge pull request #3408 from MSLaguana:addJsrtOneByteStringCopy For scenarios where a string is known to have values fitting in one byte, this method allows directly copying those values into a char* buffer rather than having to copy to a uint16_t* buffer and then to a char* buffer, and treating the string as raw bytes rather than a valid utf8 encoding. This will help reduce overhead in some common nodejs use cases.
…ngOneByte Merge pull request #3408 from MSLaguana:addJsrtOneByteStringCopy For scenarios where a string is known to have values fitting in one byte, this method allows directly copying those values into a char* buffer rather than having to copy to a uint16_t* buffer and then to a char* buffer, and treating the string as raw bytes rather than a valid utf8 encoding. This will help reduce overhead in some common nodejs use cases.
For scenarios where a string is known to have values fitting in
one byte, this method allows directly copying those values into a
char* buffer rather than having to copy to a uint16_t* buffer
and then to a char* buffer, and treating the string as raw bytes
rather than a valid utf8 encoding.
This will help reduce overhead in some common nodejs use cases.