aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1compiler
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2005-08-14 14:45:44 +0000
committerLev Walkin <vlm@lionet.info>2005-08-14 14:45:44 +0000
commit4b55341c7b5685caa260c0e346f952ba8ed8c0a7 (patch)
tree659611f19f22f2ad104399deb96ddbec517693a5 /libasn1compiler
parentc3f0b89c0ed97cf34a6a7e7730cb7a6eba540b27 (diff)
extensions of conditional native-typing to -fbless-SIZE constraints
Diffstat (limited to 'libasn1compiler')
-rw-r--r--libasn1compiler/asn1c_misc.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index bcf062f3..35de213e 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -285,12 +285,33 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
return FL_NOTFIT;
}
+ if(!expr->combined_constraints)
+ return (arg->flags & A1C_USE_NATIVE_TYPES)
+ ? FL_FORCED : FL_NOTFIT;
+
+ /*
+ * Second, if -fbless-SIZE is given, the (SIZE()) constraint may be
+ * applied (non-standard! but we can deal with this) to the type.
+ * Check the range.
+ */
+ range = asn1constraint_compute_PER_range(expr->expr_type,
+ expr->combined_constraints, ACT_CT_SIZE, 0, 0,
+ CPR_simulate_fbless_SIZE);
+ if(range) {
+ if(!range->incompatible) {
+ right = range->right;
+ /* Use 4 instead of sizeof(long) is justified! */
+ if(right.type == ARE_VALUE && right.value <= 4)
+ return FL_FITSOK;
+ }
+ asn1constraint_range_free(range);
+ }
+
/*
- * Second, pull up the PER visible range of the INTEGER.
+ * Third, pull up the PER visible range of the INTEGER.
*/
- if(expr->combined_constraints)
- range = asn1constraint_compute_PER_range(expr->expr_type,
- expr->combined_constraints, ACT_EL_RANGE, 0, 0, 0);
+ range = asn1constraint_compute_PER_range(expr->expr_type,
+ expr->combined_constraints, ACT_EL_RANGE, 0, 0, 0);
if(!range
|| range->empty_constraint
|| range->extensible