Use 'const' in string iterations.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
* @return NaN if cannot read from string, ToNumber() otherwise
|
||||
*/
|
||||
static ecma_number_t
|
||||
ecma_date_parse_date_chars (lit_utf8_byte_t **str_p, /**< pointer to the cesu8 string */
|
||||
ecma_date_parse_date_chars (const lit_utf8_byte_t **str_p, /**< pointer to the cesu8 string */
|
||||
const lit_utf8_byte_t *str_end_p, /**< pointer to the end of the string */
|
||||
uint32_t num_of_chars) /**< number of characters to read and convert */
|
||||
{
|
||||
@@ -207,7 +207,7 @@ ecma_builtin_date_parse (ecma_value_t this_arg __attr_unused___, /**< this argum
|
||||
|
||||
ECMA_STRING_TO_UTF8_STRING (date_str_p, date_start_p, date_start_size);
|
||||
|
||||
lit_utf8_byte_t *date_str_curr_p = (lit_utf8_byte_t *) date_start_p;
|
||||
const lit_utf8_byte_t *date_str_curr_p = date_start_p;
|
||||
const lit_utf8_byte_t *date_str_end_p = date_start_p + date_start_size;
|
||||
|
||||
/* 1. read year */
|
||||
|
||||
@@ -88,7 +88,7 @@ ecma_builtin_global_object_print (ecma_value_t this_arg __attr_unused___, /**< t
|
||||
lit_utf8_size_t actual_sz = ecma_string_to_utf8_string (str_p, utf8_str_p, utf8_str_size);
|
||||
JERRY_ASSERT (actual_sz == utf8_str_size);
|
||||
|
||||
lit_utf8_byte_t *utf8_str_curr_p = utf8_str_p;
|
||||
const lit_utf8_byte_t *utf8_str_curr_p = utf8_str_p;
|
||||
const lit_utf8_byte_t *utf8_str_end_p = utf8_str_p + utf8_str_size;
|
||||
|
||||
while (utf8_str_curr_p < utf8_str_end_p)
|
||||
@@ -207,13 +207,13 @@ ecma_builtin_global_object_parse_int (ecma_value_t this_arg __attr_unused___, /*
|
||||
|
||||
if (string_buff_size > 0)
|
||||
{
|
||||
lit_utf8_byte_t *string_curr_p = (lit_utf8_byte_t *) string_buff;
|
||||
const lit_utf8_byte_t *string_curr_p = (lit_utf8_byte_t *) string_buff;
|
||||
const lit_utf8_byte_t *string_end_p = string_buff + string_buff_size;
|
||||
|
||||
/* 2. Remove leading whitespace. */
|
||||
|
||||
lit_utf8_byte_t *start_p = (lit_utf8_byte_t *) string_end_p;
|
||||
lit_utf8_byte_t *end_p = start_p;
|
||||
const lit_utf8_byte_t *start_p = string_end_p;
|
||||
const lit_utf8_byte_t *end_p = start_p;
|
||||
|
||||
while (string_curr_p < string_end_p)
|
||||
{
|
||||
@@ -426,11 +426,11 @@ ecma_builtin_global_object_parse_float (ecma_value_t this_arg __attr_unused___,
|
||||
|
||||
if (string_buff_size > 0)
|
||||
{
|
||||
lit_utf8_byte_t *str_curr_p = (lit_utf8_byte_t *) string_buff;
|
||||
const lit_utf8_byte_t *str_curr_p = string_buff;
|
||||
const lit_utf8_byte_t *str_end_p = string_buff + string_buff_size;
|
||||
|
||||
lit_utf8_byte_t *start_p = (lit_utf8_byte_t *) str_end_p;
|
||||
lit_utf8_byte_t *end_p = (lit_utf8_byte_t *) str_end_p;
|
||||
const lit_utf8_byte_t *start_p = str_end_p;
|
||||
const lit_utf8_byte_t *end_p = str_end_p;
|
||||
|
||||
/* 2. Find first non whitespace char and set starting position. */
|
||||
while (str_curr_p < str_end_p)
|
||||
@@ -1263,8 +1263,8 @@ ecma_builtin_global_object_escape (ecma_value_t this_arg __attr_unused___, /**<
|
||||
* The escape routine has two major phases: first we compute
|
||||
* the length of the output, then we encode the input.
|
||||
*/
|
||||
lit_utf8_byte_t *input_curr_p = input_start_p;
|
||||
lit_utf8_byte_t *input_end_p = input_start_p + input_size;
|
||||
const lit_utf8_byte_t *input_curr_p = input_start_p;
|
||||
const lit_utf8_byte_t *input_end_p = input_start_p + input_size;
|
||||
lit_utf8_size_t output_length = 0;
|
||||
|
||||
while (input_curr_p < input_end_p)
|
||||
@@ -1377,8 +1377,8 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
|
||||
lit_utf8_size_t sz = ecma_string_to_utf8_string (input_string_p, input_start_p, input_size);
|
||||
JERRY_ASSERT (sz == input_size);
|
||||
|
||||
lit_utf8_byte_t *input_curr_p = input_start_p;
|
||||
lit_utf8_byte_t *input_end_p = input_start_p + input_size;
|
||||
const lit_utf8_byte_t *input_curr_p = input_start_p;
|
||||
const lit_utf8_byte_t *input_end_p = input_start_p + input_size;
|
||||
/* 4. */
|
||||
/* The length of input string is always greater than output string
|
||||
* so we re-use the input string buffer.
|
||||
|
||||
@@ -582,7 +582,7 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index
|
||||
|
||||
ecma_length_t index = start_pos;
|
||||
|
||||
lit_utf8_byte_t *original_str_curr_p = (lit_utf8_byte_t *) original_str_utf8_p;
|
||||
const lit_utf8_byte_t *original_str_curr_p = original_str_utf8_p;
|
||||
for (ecma_length_t idx = 0; idx < index; idx++)
|
||||
{
|
||||
lit_utf8_incr (&original_str_curr_p);
|
||||
@@ -591,7 +591,7 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index
|
||||
/* create utf8 string from search string */
|
||||
ECMA_STRING_TO_UTF8_STRING (search_str_p, search_str_utf8_p, search_str_size);
|
||||
|
||||
lit_utf8_byte_t *search_str_curr_p = (lit_utf8_byte_t *) search_str_utf8_p;
|
||||
const lit_utf8_byte_t *search_str_curr_p = search_str_utf8_p;
|
||||
|
||||
/* iterate original string and try to match at each position */
|
||||
bool searching = true;
|
||||
@@ -600,13 +600,13 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index
|
||||
{
|
||||
/* match as long as possible */
|
||||
ecma_length_t match_len = 0;
|
||||
lit_utf8_byte_t *stored_original_str_curr_p = original_str_curr_p;
|
||||
const lit_utf8_byte_t *stored_original_str_curr_p = original_str_curr_p;
|
||||
|
||||
if (match_len < search_len &&
|
||||
index + match_len < original_len &&
|
||||
lit_utf8_read_next (&original_str_curr_p) == first_char)
|
||||
{
|
||||
lit_utf8_byte_t *nested_search_str_curr_p = search_str_curr_p;
|
||||
const lit_utf8_byte_t *nested_search_str_curr_p = search_str_curr_p;
|
||||
match_len++;
|
||||
|
||||
while (match_len < search_len &&
|
||||
|
||||
@@ -1059,7 +1059,7 @@ ecma_builtin_json_quote (ecma_string_t *string_p) /**< string that should be quo
|
||||
|
||||
ECMA_STRING_TO_UTF8_STRING (string_p, string_buff, string_buff_size);
|
||||
|
||||
lit_utf8_byte_t *str_p = (lit_utf8_byte_t *) string_buff;
|
||||
const lit_utf8_byte_t *str_p = string_buff;
|
||||
const lit_utf8_byte_t *str_end_p = string_buff + string_buff_size;
|
||||
|
||||
while (str_p < str_end_p)
|
||||
|
||||
@@ -2074,7 +2074,7 @@ ecma_builtin_string_prototype_object_conversion_helper (ecma_value_t this_arg, /
|
||||
*/
|
||||
|
||||
lit_utf8_size_t output_length = 0;
|
||||
lit_utf8_byte_t *input_str_curr_p = (lit_utf8_byte_t *) input_start_p;
|
||||
const lit_utf8_byte_t *input_str_curr_p = input_start_p;
|
||||
const lit_utf8_byte_t *input_str_end_p = input_start_p + input_start_size;
|
||||
|
||||
while (input_str_curr_p < input_str_end_p)
|
||||
@@ -2114,7 +2114,7 @@ ecma_builtin_string_prototype_object_conversion_helper (ecma_value_t this_arg, /
|
||||
lit_utf8_byte_t *output_char_p = output_start_p;
|
||||
|
||||
/* Encoding the output. */
|
||||
input_str_curr_p = (lit_utf8_byte_t *) input_start_p;
|
||||
input_str_curr_p = input_start_p;
|
||||
|
||||
while (input_str_curr_p < input_str_end_p)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user