aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1fix
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-09-15 11:46:23 +0000
committerLev Walkin <vlm@lionet.info>2004-09-15 11:46:23 +0000
commit9fb535979761624f72bdfc9fecbca19889c4a9de (patch)
tree37d030c732303aa6de7de7c3e1bd9eb651da6c88 /libasn1fix
parentfd97d5ecac227a7896d59c2d37e994739acf332a (diff)
dereferencing DEFAULT value
Diffstat (limited to 'libasn1fix')
-rw-r--r--libasn1fix/asn1fix_derefv.c54
1 files changed, 19 insertions, 35 deletions
diff --git a/libasn1fix/asn1fix_derefv.c b/libasn1fix/asn1fix_derefv.c
index a00eac9c..eb67ac3f 100644
--- a/libasn1fix/asn1fix_derefv.c
+++ b/libasn1fix/asn1fix_derefv.c
@@ -8,47 +8,31 @@ asn1f_fix_dereference_values(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
int r_value = 0;
- if(expr->meta_type != AMT_VALUE)
- return 0; /* Just ignore it */
-
- if(expr->value == NULL)
- return 0; /* Just ignore it */
-
- if(expr->value && expr->value->type != ATV_REFERENCED)
- return 0; /* Not a reference */
-
- DEBUG("%s(%s %x ::= %s) for line %d", __func__,
- expr->Identifier, expr->expr_type,
- asn1f_printable_value(expr->value), expr->_lineno);
-
- /*
- * If this integer has a value, check that this value
- * is an integer. If it is a reference, resolve it.
- */
- if(expr->value) {
-
+ if(expr->value && expr->meta_type == AMT_VALUE) {
if(asn1f_value_resolve(arg, expr)) {
/* This function will emit messages */
r_value = -1;
}
+ }
- if(0 && expr->value->type != ATV_INTEGER) {
- FATAL(
- "INTEGER value %s at line %d: "
- "Incompatible value specified: %s",
- expr->Identifier,
- expr->_lineno,
- asn1f_printable_value(expr->value)
- );
- r_value = -1;
+ if(expr->marker.default_value) {
+ arg_t tmparg = *arg;
+ asn1p_expr_t tmpexpr = *expr;
+
+ switch(expr->marker.default_value->type) {
+ default:
+ return r_value;
+ case ATV_REFERENCED:
+ break;
}
- } else {
- FATAL("Value of \"%s\" at line %d: "
- "Incompatible value specified",
- expr->Identifier,
- expr->_lineno
- );
- r_value = -1;
+
+ tmparg.expr = &tmpexpr;
+ tmpexpr.meta_type = AMT_VALUE;
+ tmpexpr.marker.default_value = 0;
+ tmpexpr.value = expr->marker.default_value;
+ if(asn1f_value_resolve(&tmparg, &tmpexpr))
+ r_value = -1;
+ expr->marker.default_value = tmpexpr.value;
}
return r_value;