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:
Akos Kiss
2016-03-07 19:08:57 +01:00
parent ce2fc3ccfd
commit 25b0750756
24 changed files with 228 additions and 331 deletions
+4 -4
View File
@@ -353,10 +353,10 @@ lit_char_is_word_char (ecma_char_t c) /**< code unit */
* @return the length of the lowercase character sequence
* which is always between 1 and LIT_MAXIMUM_OTHER_CASE_LENGTH.
*/
lit_utf8_size_t
ecma_length_t
lit_char_to_lower_case (ecma_char_t character, /**< input character value */
ecma_char_t *output_buffer_p, /**< [out] buffer for the result characters */
size_t buffer_size) /**< buffer size */
ecma_length_t buffer_size) /**< buffer size */
{
TODO ("Needs a proper lower case implementation. See issue #323.");
@@ -387,10 +387,10 @@ lit_char_to_lower_case (ecma_char_t character, /**< input character value */
* @return the length of the uppercase character sequence
* which is always between 1 and LIT_MAXIMUM_OTHER_CASE_LENGTH.
*/
lit_utf8_size_t
ecma_length_t
lit_char_to_upper_case (ecma_char_t character, /**< input character value */
ecma_char_t *output_buffer_p, /**< buffer for the result characters */
size_t buffer_size) /**< buffer size */
ecma_length_t buffer_size) /**< buffer size */
{
TODO ("Needs a proper upper case implementation. See issue #323.");