From 84f09ffcd9e586e9a409231f8d24f144f1396a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Lang=C3=B3?= Date: Mon, 13 Jul 2015 11:03:54 +0200 Subject: [PATCH] Follow up fix for Date.prototype.toString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com --- .../ecma/builtin-objects/ecma-builtin-date-prototype.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.cpp index 5cdafb4c2..9fa764400 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.cpp @@ -53,7 +53,9 @@ ecma_date_insert_leading_zeros (ecma_string_t **str_p, /**< input/output string JERRY_ASSERT (length >= 1); /* If the length is bigger than the number of digits in num, then insert leding zeros. */ - for (uint32_t i = length - 1; i > 0 && num < pow (10,i); i--) + uint32_t first_index = length - 1u; + ecma_number_t power_i = (ecma_number_t) pow (10, first_index); + for (uint32_t i = first_index; i > 0 && num < power_i; i--, power_i /= 10) { ecma_string_t *zero_str_p = ecma_new_ecma_string_from_uint32 (0); ecma_string_t *concat_p = ecma_concat_ecma_strings (zero_str_p, *str_p);