aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen_per.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-12-21 15:08:59 +0100
committerBjörn Gustavsson <[email protected]>2013-01-22 19:20:13 +0100
commit2e57d4603575f492f54409e8235806ee6702944c (patch)
treea94fcbb5292e042aa5b0c15bca237da643022fd7 /lib/asn1/src/asn1ct_gen_per.erl
parent3f8be66021a5b3ce764181a2f9685ed7bfc81607 (diff)
downloadotp-2e57d4603575f492f54409e8235806ee6702944c.tar.gz
otp-2e57d4603575f492f54409e8235806ee6702944c.tar.bz2
otp-2e57d4603575f492f54409e8235806ee6702944c.zip
uper: Look up some SizeConstraints at compile-time
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_per.erl')
-rw-r--r--lib/asn1/src/asn1ct_gen_per.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl
index b7f3a12040..a43975a308 100644
--- a/lib/asn1/src/asn1ct_gen_per.erl
+++ b/lib/asn1/src/asn1ct_gen_per.erl
@@ -158,8 +158,9 @@ gen_encode_prim(Erules,D,DoTag,Value) when is_record(D,type) ->
emit_enc_real(Erules, Value);
{'BIT STRING',NamedNumberList} ->
+ SizeConstr = get_constraint(Constraint, 'SizeConstraint'),
call(Erules, encode_bit_string,
- [{asis,Constraint},Value,
+ [{asis,SizeConstr},Value,
{asis,NamedNumberList}]);
'NULL' ->
emit("[]");
@@ -173,7 +174,14 @@ gen_encode_prim(Erules,D,DoTag,Value) when is_record(D,type) ->
'BOOLEAN' ->
call(Erules, encode_boolean, [Value]);
'OCTET STRING' ->
- call(Erules, encode_octet_string, [{asis,Constraint},Value]);
+ case get_constraint(Constraint, 'SizeConstraint') of
+ 0 ->
+ emit("[]");
+ no ->
+ call(Erules, encode_octet_string, [Value]);
+ C ->
+ call(Erules, encode_octet_string, [{asis,C},Value])
+ end;
'NumericString' ->
call(Erules, encode_NumericString, [{asis,Constraint},Value]);
TString when TString == 'TeletexString';