Fix problems arising from incorrect use of various size types
E.g., * `ssize_t` was used where `lit_utf8_size_t` or `jerry_api_size_t` would have been correct, * `lit_utf8_size_t` was used where `ecma_length_t` would have been correct. Note, the patch also includes internal and public API changes: * `ecma_string_to_utf8_string` does not return negative value if output buffer is not large enough to contain the string; the buffer is expected to be large enough. (`ecma_string_get_size` can be used to retrieve the required size.) * `jerry_api_string_to_char_buffer` adapts the same logic (and `jerry_api_get_string_size` can be used to determine the required size of the buffer). Related issue: #942 JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -257,14 +257,14 @@ lit_compare_utf8_string_and_magic_string_ex (const lit_utf8_byte_t *string_p, /*
|
||||
extern lit_utf8_byte_t *
|
||||
lit_copy_magic_string_to_buffer (lit_magic_string_id_t id, /**< magic string id */
|
||||
lit_utf8_byte_t *buffer_p, /**< destination buffer */
|
||||
ssize_t buffer_size) /**< size of buffer */
|
||||
lit_utf8_size_t buffer_size) /**< size of buffer */
|
||||
{
|
||||
const lit_utf8_byte_t *magic_string_bytes_p = lit_get_magic_string_utf8 (id);
|
||||
lit_utf8_size_t magic_string_bytes_count = lit_get_magic_string_size (id);
|
||||
|
||||
const lit_utf8_byte_t *str_iter_p = magic_string_bytes_p;
|
||||
lit_utf8_byte_t *buf_iter_p = buffer_p;
|
||||
ssize_t bytes_copied = 0;
|
||||
lit_utf8_size_t bytes_copied = 0;
|
||||
|
||||
while (magic_string_bytes_count--)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user