aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen_per.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-01-29 10:50:21 +0100
committerBjörn Gustavsson <[email protected]>2014-01-29 10:50:21 +0100
commit228ef1c22ee2f6f39183091aa70f17417c3d9aa6 (patch)
tree7d2203d6df886ce1d7f2344dbfd3e6ec7c8a5c3d /lib/asn1/src/asn1ct_gen_per.erl
parentae2c2f1d838b523939b586014ceb66c2970b8cf2 (diff)
parentd16a480a43a858d604d1ac8d644589be3f49dda1 (diff)
downloadotp-228ef1c22ee2f6f39183091aa70f17417c3d9aa6.tar.gz
otp-228ef1c22ee2f6f39183091aa70f17417c3d9aa6.tar.bz2
otp-228ef1c22ee2f6f39183091aa70f17417c3d9aa6.zip
Merge branch 'bjorn/asn1/erlang-types/OTP-11594'
* bjorn/asn1/erlang-types/OTP-11594: Update documentation Fix open types Fix OCTET STRING Fix BIT STRING Add legacy_erlang_types asn1 test suite: Modernize testTimer_* and testTimer.erl testPrimStrings: Run test of fragmented strings for PER too
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_per.erl')
-rw-r--r--lib/asn1/src/asn1ct_gen_per.erl22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl
index 7ba649c874..519ce9f054 100644
--- a/lib/asn1/src/asn1ct_gen_per.erl
+++ b/lib/asn1/src/asn1ct_gen_per.erl
@@ -132,7 +132,14 @@ gen_encode_prim_imm(Val, #type{def=Type0,constraint=Constraint}, Aligned) ->
ToBinary = {real_common,encode_real},
asn1ct_imm:per_enc_restricted_string(Val, ToBinary, Aligned);
{'BIT STRING',NNL} ->
- asn1ct_imm:per_enc_bit_string(Val, NNL, Constraint, Aligned);
+ case asn1ct:use_legacy_types() of
+ false ->
+ asn1ct_imm:per_enc_bit_string(Val, NNL,
+ Constraint, Aligned);
+ true ->
+ asn1ct_imm:per_enc_legacy_bit_string(Val, NNL,
+ Constraint, Aligned)
+ end;
'NULL' ->
asn1ct_imm:per_enc_null(Val, Aligned);
'OBJECT IDENTIFIER' ->
@@ -144,7 +151,13 @@ gen_encode_prim_imm(Val, #type{def=Type0,constraint=Constraint}, Aligned) ->
'BOOLEAN' ->
asn1ct_imm:per_enc_boolean(Val, Aligned);
'OCTET STRING' ->
- asn1ct_imm:per_enc_octet_string(Val, Constraint, Aligned);
+ case asn1ct:use_legacy_types() of
+ false ->
+ asn1ct_imm:per_enc_octet_string(Val, Constraint, Aligned);
+ true ->
+ asn1ct_imm:per_enc_legacy_octet_string(Val, Constraint,
+ Aligned)
+ end;
'ASN1_OPEN_TYPE' ->
case Constraint of
[#'Externaltypereference'{type=Tname}] ->
@@ -325,7 +338,10 @@ gen_dec_imm_1('GeneralizedTime', Constraint, Aligned) ->
gen_dec_imm_1('OCTET STRING', Constraint, Aligned) ->
SzConstr = asn1ct_imm:effective_constraint(bitstring, Constraint),
Imm = asn1ct_imm:per_dec_octet_string(SzConstr, Aligned),
- {convert,binary_to_list,Imm};
+ case asn1ct:use_legacy_types() of
+ false -> {convert,{binary,copy},Imm};
+ true -> {convert,binary_to_list,Imm}
+ end;
gen_dec_imm_1('TeletexString', _Constraint, Aligned) ->
gen_dec_restricted_string(Aligned);
gen_dec_imm_1('T61String', _Constraint, Aligned) ->