diff options
author | Björn Gustavsson <[email protected]> | 2013-10-21 11:59:54 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-10-21 11:59:54 +0200 |
commit | 9676a78c5cdeeea311048a7d9630f333811747d1 (patch) | |
tree | 5730f03f62d0dda2146491c1d208d6620a3b0c9d /lib/asn1/src/asn1ct_value.erl | |
parent | 666b46a914ddc23ad666222476163c46c06d2b14 (diff) | |
parent | c28e62178eced67090d5e5f40d0f6207a6875740 (diff) | |
download | otp-9676a78c5cdeeea311048a7d9630f333811747d1.tar.gz otp-9676a78c5cdeeea311048a7d9630f333811747d1.tar.bz2 otp-9676a78c5cdeeea311048a7d9630f333811747d1.zip |
Merge branch 'bjorn/asn1/fix-extensible-single-values/OTP-11415' into maint
* bjorn/asn1/fix-extensible-single-values/OTP-11415:
PER/UPER: Correct encoding for single-value extensible constraints
asn1ct_value: Handle named INTEGERs with constraints
Diffstat (limited to 'lib/asn1/src/asn1ct_value.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_value.erl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/asn1/src/asn1ct_value.erl b/lib/asn1/src/asn1ct_value.erl index 992210232f..862b3c4ea5 100644 --- a/lib/asn1/src/asn1ct_value.erl +++ b/lib/asn1/src/asn1ct_value.erl @@ -167,17 +167,16 @@ from_type_prim(M, D) -> case D#type.def of 'INTEGER' -> i_random(C); - {'INTEGER',NamedNumberList} -> - NN = [X||{X,_} <- NamedNumberList], - case NN of + {'INTEGER',[_|_]=NNL} -> + case C of [] -> - i_random(C); + {N,_} = lists:nth(random(length(NNL)), NNL), + N; _ -> - case C of - [] -> - lists:nth(random(length(NN)),NN); - _ -> - lists:nth((fun(0)->1;(X)->X end(i_random(C))),NN) + V = i_random(C), + case lists:keyfind(V, 2, NNL) of + false -> V; + {N,V} -> N end end; Enum when is_tuple(Enum),element(1,Enum)=='ENUMERATED' -> |