Update documentation for jerry string to buffer function with suggestions to use substring. (#2174) (#2174)
In some use cases, you want to reliably copy jerry strings to buffer, even if it doesn't fit target buffer, but is acceptable to lose some bytes. In those cases, the documentation will now suggest using the substring function as an alternative instead. JerryScript-DCO-1.0-Signed-off-by: Brian Khuu mofosyne@gmail.com
This commit is contained in:
@@ -1521,6 +1521,11 @@ jerry_get_utf8_string_length (const jerry_value_t value) /**< input string */
|
||||
* Returns 0, if the value parameter is not a string or
|
||||
* the buffer is not large enough for the whole string.
|
||||
*
|
||||
* Note:
|
||||
* If the size of the string in jerry value is larger than the size of the
|
||||
* target buffer, the copy will fail.
|
||||
* To copy substring use jerry_substring_to_char_buffer() instead.
|
||||
*
|
||||
* @return number of bytes, actually copied to the buffer.
|
||||
*/
|
||||
jerry_size_t
|
||||
@@ -1557,6 +1562,11 @@ jerry_string_to_char_buffer (const jerry_value_t value, /**< input string value
|
||||
* Returns 0, if the value parameter is not a string or the buffer
|
||||
* is not large enough for the whole string.
|
||||
*
|
||||
* Note:
|
||||
* If the size of the string in jerry value is larger than the size of the
|
||||
* target buffer, the copy will fail.
|
||||
* To copy a substring use jerry_substring_to_utf8_char_buffer() instead.
|
||||
*
|
||||
* @return number of bytes copied to the buffer.
|
||||
*/
|
||||
jerry_size_t
|
||||
|
||||
Reference in New Issue
Block a user