Warning fixes.

Passing argument 1 of ‘strncmp’ from incompatible pointer type.
Assignments from incompatible pointer types.
Passing argument or initialization discards ‘const’ qualifier from pointer target type.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka
2016-03-07 14:02:26 +01:00
parent 25b0750756
commit 0b5a49f98b
9 changed files with 21 additions and 21 deletions
@@ -132,7 +132,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
/* FIXME: "We currently have to re-compile the bytecode, because /* FIXME: "We currently have to re-compile the bytecode, because
* we can't copy it without knowing its length." * we can't copy it without knowing its length."
*/ */
re_compiled_code_t *new_bc_p = NULL; const re_compiled_code_t *new_bc_p = NULL;
ecma_value_t bc_comp = re_compile_bytecode (&new_bc_p, pattern_string_p, flags); ecma_value_t bc_comp = re_compile_bytecode (&new_bc_p, pattern_string_p, flags);
/* Should always succeed, since we're compiling from a source that has been compiled previously. */ /* Should always succeed, since we're compiling from a source that has been compiled previously. */
JERRY_ASSERT (ecma_is_value_empty (bc_comp)); JERRY_ASSERT (ecma_is_value_empty (bc_comp));
@@ -201,7 +201,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
ecma_property_t *bc_prop_p = ecma_get_internal_property (this_obj_p, ecma_property_t *bc_prop_p = ecma_get_internal_property (this_obj_p,
ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE); ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
/* Try to compile bytecode from new source. */ /* Try to compile bytecode from new source. */
re_compiled_code_t *new_bc_p = NULL; const re_compiled_code_t *new_bc_p = NULL;
ECMA_TRY_CATCH (bc_dummy, ECMA_TRY_CATCH (bc_dummy,
re_compile_bytecode (&new_bc_p, pattern_string_p, flags), re_compile_bytecode (&new_bc_p, pattern_string_p, flags),
ret_value); ret_value);
@@ -306,7 +306,7 @@ ecma_op_create_regexp_object (ecma_string_t *pattern_p, /**< input pattern */
bytecode_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE); bytecode_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
/* Compile bytecode. */ /* Compile bytecode. */
re_compiled_code_t *bc_p = NULL; const re_compiled_code_t *bc_p = NULL;
ECMA_TRY_CATCH (empty, re_compile_bytecode (&bc_p, pattern_p, flags), ret_value); ECMA_TRY_CATCH (empty, re_compile_bytecode (&bc_p, pattern_p, flags), ret_value);
ECMA_SET_POINTER (bytecode_prop_p->v.internal_property.value, bc_p); ECMA_SET_POINTER (bytecode_prop_p->v.internal_property.value, bc_p);
+1 -1
View File
@@ -2171,7 +2171,7 @@ snapshot_load_compiled_code (const uint8_t *snapshot_data_p, /**< snapshot data
if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION)) if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION))
{ {
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN #ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
re_compiled_code_t *re_bytecode_p = NULL; const re_compiled_code_t *re_bytecode_p = NULL;
const uint8_t *regex_start_p = ((const uint8_t *) bytecode_p) + sizeof (uint16_t); const uint8_t *regex_start_p = ((const uint8_t *) bytecode_p) + sizeof (uint16_t);
+1 -1
View File
@@ -129,7 +129,7 @@ lit_find_literal_by_utf8_string (const lit_utf8_byte_t *str_p, /**< a string to
continue; continue;
} }
if (!strncmp (rec_p + 1, (const char *) str_p, str_size)) if (!strncmp ((const char *) (rec_p + 1), (const char *) str_p, str_size))
{ {
return lit; return lit;
} }
+1 -1
View File
@@ -260,7 +260,7 @@ void *mem_heap_alloc_block_internal (const size_t size)
} }
else else
{ {
JERRY_ASSERT (MEM_HEAP_GET_ADDR_FROM_OFFSET (mem_heap.first.next_offset)->size > MEM_ALIGNMENT); JERRY_ASSERT (data_space_p->size > MEM_ALIGNMENT);
mem_heap_free_t *const remaining_p = MEM_HEAP_GET_ADDR_FROM_OFFSET (mem_heap.first.next_offset) + 1; mem_heap_free_t *const remaining_p = MEM_HEAP_GET_ADDR_FROM_OFFSET (mem_heap.first.next_offset) + 1;
VALGRIND_DEFINED_SPACE (remaining_p, sizeof (mem_heap_free_t)); VALGRIND_DEFINED_SPACE (remaining_p, sizeof (mem_heap_free_t));
+2 -2
View File
@@ -37,9 +37,9 @@
/** /**
* Node for free chunk list * Node for free chunk list
*/ */
typedef struct typedef struct mem_pools_chunk
{ {
struct mem_pools_chunk_t *next_p; /* pointer to next pool chunk */ struct mem_pools_chunk *next_p; /* pointer to next pool chunk */
#ifndef MEM_HEAP_PTR_64 #ifndef MEM_HEAP_PTR_64
uint32_t dummy; /* dummy member for alignment */ uint32_t dummy; /* dummy member for alignment */
#endif #endif
+1 -1
View File
@@ -1808,7 +1808,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
context_p->literal_count++; context_p->literal_count++;
/* Compile the RegExp literal and store the RegExp bytecode pointer */ /* Compile the RegExp literal and store the RegExp bytecode pointer */
re_compiled_code_t *re_bytecode_p = NULL; const re_compiled_code_t *re_bytecode_p = NULL;
ecma_value_t completion_value; ecma_value_t completion_value;
ecma_string_t *pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, length); ecma_string_t *pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, length);
+10 -10
View File
@@ -41,12 +41,12 @@
*/ */
static void static void
re_append_char_class (void *re_ctx_p, /**< RegExp compiler context */ re_append_char_class (void *re_ctx_p, /**< RegExp compiler context */
ecma_char_t start, /**< character class range from */ uint32_t start, /**< character class range from */
ecma_char_t end) /**< character class range to */ uint32_t end) /**< character class range to */
{ {
re_compiler_ctx_t *ctx_p = (re_compiler_ctx_t *) re_ctx_p; re_compiler_ctx_t *ctx_p = (re_compiler_ctx_t *) re_ctx_p;
re_append_char (ctx_p->bytecode_ctx_p, start); re_append_char (ctx_p->bytecode_ctx_p, (ecma_char_t) start);
re_append_char (ctx_p->bytecode_ctx_p, end); re_append_char (ctx_p->bytecode_ctx_p, (ecma_char_t) end);
ctx_p->parser_ctx_p->num_of_classes++; ctx_p->parser_ctx_p->num_of_classes++;
} /* re_append_char_class */ } /* re_append_char_class */
@@ -452,7 +452,7 @@ static const re_compiled_code_t *re_cache[RE_CACHE_SIZE];
* @return compiled bytecode - if found * @return compiled bytecode - if found
* NULL - otherwise * NULL - otherwise
*/ */
re_compiled_code_t * const re_compiled_code_t *
re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
uint16_t flags, /**< flags */ uint16_t flags, /**< flags */
uint32_t *idx) /**< [out] index */ uint32_t *idx) /**< [out] index */
@@ -461,7 +461,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
for (*idx = 0u; *idx < RE_CACHE_SIZE; (*idx)++) for (*idx = 0u; *idx < RE_CACHE_SIZE; (*idx)++)
{ {
re_compiled_code_t *cached_bytecode_p = re_cache[*idx]; const re_compiled_code_t *cached_bytecode_p = re_cache[*idx];
if (cached_bytecode_p != NULL) if (cached_bytecode_p != NULL)
{ {
@@ -495,13 +495,13 @@ re_cache_gc_run ()
{ {
for (uint32_t i = 0u; i < RE_CACHE_SIZE; i++) for (uint32_t i = 0u; i < RE_CACHE_SIZE; i++)
{ {
re_compiled_code_t *cached_bytecode_p = re_cache[i]; const re_compiled_code_t *cached_bytecode_p = re_cache[i];
if (cached_bytecode_p != NULL if (cached_bytecode_p != NULL
&& (cached_bytecode_p->flags >> ECMA_BYTECODE_REF_SHIFT) == 1) && (cached_bytecode_p->flags >> ECMA_BYTECODE_REF_SHIFT) == 1)
{ /* Only the cache has reference for the bytecode */ { /* Only the cache has reference for the bytecode */
ecma_bytecode_deref (cached_bytecode_p); ecma_bytecode_deref ((ecma_compiled_code_t *) cached_bytecode_p);
re_cache[i] = NULL; re_cache[i] = NULL;
} }
} }
@@ -516,7 +516,7 @@ re_cache_gc_run ()
* Returned value must be freed with ecma_free_value * Returned value must be freed with ecma_free_value
*/ */
ecma_value_t ecma_value_t
re_compile_bytecode (re_compiled_code_t **out_bytecode_p, /**< [out] pointer to bytecode */ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] pointer to bytecode */
ecma_string_t *pattern_str_p, /**< pattern */ ecma_string_t *pattern_str_p, /**< pattern */
uint16_t flags) /**< flags */ uint16_t flags) /**< flags */
{ {
@@ -604,7 +604,7 @@ re_compile_bytecode (re_compiled_code_t **out_bytecode_p, /**< [out] pointer to
if (cache_idx < RE_CACHE_SIZE) if (cache_idx < RE_CACHE_SIZE)
{ {
ecma_bytecode_ref (*out_bytecode_p); ecma_bytecode_ref ((ecma_compiled_code_t *) *out_bytecode_p);
re_cache[cache_idx] = *out_bytecode_p; re_cache[cache_idx] = *out_bytecode_p;
} }
else else
+2 -2
View File
@@ -48,9 +48,9 @@ typedef struct
} re_compiler_ctx_t; } re_compiler_ctx_t;
ecma_value_t ecma_value_t
re_compile_bytecode (re_compiled_code_t **, ecma_string_t *, uint16_t); re_compile_bytecode (const re_compiled_code_t **, ecma_string_t *, uint16_t);
re_compiled_code_t * const re_compiled_code_t *
re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, uint16_t flags, uint32_t *idx); re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, uint16_t flags, uint32_t *idx);
void re_cache_gc_run (); void re_cache_gc_run ();