Commit cf3f6ebb authored by Lev Walkin's avatar Lev Walkin

constness fix

parent 792641ee
...@@ -1375,7 +1375,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { ...@@ -1375,7 +1375,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
&& etd_spec == ETD_NO_SPECIFICS && etd_spec == ETD_NO_SPECIFICS
&& 0 /* This shortcut is incompatible with XER */ && 0 /* This shortcut is incompatible with XER */
) { ) {
char *type_name; const char *type_name;
REDIR(OT_FUNC_DECLS); REDIR(OT_FUNC_DECLS);
type_name = asn1c_type_name(arg, expr, TNF_SAFE); type_name = asn1c_type_name(arg, expr, TNF_SAFE);
OUT("/* This type is equivalent to %s */\n", type_name); OUT("/* This type is equivalent to %s */\n", type_name);
...@@ -2911,7 +2911,7 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t * ...@@ -2911,7 +2911,7 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t *
struct asn1p_type_tag_s outmost_tag_s; struct asn1p_type_tag_s outmost_tag_s;
struct asn1p_type_tag_s *outmost_tag; struct asn1p_type_tag_s *outmost_tag;
int complex_contents; int complex_contents;
char *p; const char *p;
if(WITH_MODULE_NAMESPACE( if(WITH_MODULE_NAMESPACE(
expr->module, expr_ns, expr->module, expr_ns,
...@@ -3017,7 +3017,7 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t * ...@@ -3017,7 +3017,7 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t *
if(arg->flags & A1C_NO_CONSTRAINTS) { if(arg->flags & A1C_NO_CONSTRAINTS) {
OUT("0,\t/* No check because of -fno-constraints */\n"); OUT("0,\t/* No check because of -fno-constraints */\n");
} else { } else {
char *id = MKID(expr); const char *id = MKID(expr);
if(expr->_anonymous_type if(expr->_anonymous_type
&& !strcmp(expr->Identifier, "Member")) && !strcmp(expr->Identifier, "Member"))
id = asn1c_type_name(arg, expr, TNF_SAFE); id = asn1c_type_name(arg, expr, TNF_SAFE);
...@@ -3108,7 +3108,7 @@ static int ...@@ -3108,7 +3108,7 @@ static int
emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_count, int all_tags_count, int elements_count, enum etd_spec spec) { emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_count, int all_tags_count, int elements_count, enum etd_spec spec) {
asn1p_expr_t *terminal; asn1p_expr_t *terminal;
int using_type_name = 0; int using_type_name = 0;
char *p = MKID(expr); const char *p = MKID(expr);
char *p2 = (char *)0; char *p2 = (char *)0;
terminal = asn1f_find_terminal_type_ex(arg->asn, arg->ns, expr); terminal = asn1f_find_terminal_type_ex(arg->asn, arg->ns, expr);
......
...@@ -92,7 +92,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) { ...@@ -92,7 +92,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
break; break;
} }
if(produce_st) { if(produce_st) {
char *tname = asn1c_type_name(arg, arg->expr, TNF_SAFE); const char *tname = asn1c_type_name(arg, arg->expr, TNF_SAFE);
OUT("const %s_t *st = (const %s_t *)sptr;\n", tname, tname); OUT("const %s_t *st = (const %s_t *)sptr;\n", tname, tname);
} }
...@@ -427,7 +427,7 @@ static int ...@@ -427,7 +427,7 @@ static int
emit_alphabet_check_loop(arg_t *arg, asn1cnst_range_t *range) { emit_alphabet_check_loop(arg_t *arg, asn1cnst_range_t *range) {
asn1c_integer_t natural_stop; asn1c_integer_t natural_stop;
asn1p_expr_t *terminal; asn1p_expr_t *terminal;
char *tname; const char *tname;
terminal = asn1f_find_terminal_type_ex(arg->asn, arg->ns, arg->expr); terminal = asn1f_find_terminal_type_ex(arg->asn, arg->ns, arg->expr);
if(terminal) { if(terminal) {
......
...@@ -168,13 +168,13 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) { ...@@ -168,13 +168,13 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) {
return storage; return storage;
} }
char * const char *
asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
asn1p_expr_t *exprid = 0; asn1p_expr_t *exprid = 0;
asn1p_expr_t *top_parent; asn1p_expr_t *top_parent;
asn1p_expr_t *terminal = 0; asn1p_expr_t *terminal = 0;
int stdname = 0; int stdname = 0;
char *typename; const char *typename;
/* Rewind to the topmost parent expression */ /* Rewind to the topmost parent expression */
if((top_parent = expr->parent_expr)) if((top_parent = expr->parent_expr))
......
...@@ -16,6 +16,8 @@ char *asn1c_make_identifier(enum ami_flags_e, asn1p_expr_t *expr, ...); ...@@ -16,6 +16,8 @@ char *asn1c_make_identifier(enum ami_flags_e, asn1p_expr_t *expr, ...);
/* /*
* Return the type name of the specified expression. * Return the type name of the specified expression.
* The returned string is a pointer to a statically allocated buffer which is
* going to be clobbered by the subsequent invocation of this function.
*/ */
enum tnfmt { enum tnfmt {
TNF_UNMODIFIED = 0x10, /* Return unmodified type name */ TNF_UNMODIFIED = 0x10, /* Return unmodified type name */
...@@ -24,7 +26,7 @@ enum tnfmt { ...@@ -24,7 +26,7 @@ enum tnfmt {
TNF_SAFE = 0x40, /* Replace unsafe characters with _ */ TNF_SAFE = 0x40, /* Replace unsafe characters with _ */
TNF_RSAFE = 0x50, /* Recursion-safe C type format */ TNF_RSAFE = 0x50, /* Recursion-safe C type format */
}; };
char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format); const char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format);
/* /*
* Check whether the specified INTEGER or ENUMERATED type can be represented * Check whether the specified INTEGER or ENUMERATED type can be represented
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment