diff options
author | Björn Gustavsson <[email protected]> | 2014-05-06 14:03:18 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-06-05 13:46:28 +0200 |
commit | 6b74e6b29dba58b7d54e9e7c4d8f3e1ab28fa66d (patch) | |
tree | 71266962cb75102fb97a09913a70ca914a5f8dbd /lib/asn1/src/asn1ct_gen_ber_bin_v2.erl | |
parent | 4e88e704e902c774327d08f40f310d3d1572f2b6 (diff) | |
download | otp-6b74e6b29dba58b7d54e9e7c4d8f3e1ab28fa66d.tar.gz otp-6b74e6b29dba58b7d54e9e7c4d8f3e1ab28fa66d.tar.bz2 otp-6b74e6b29dba58b7d54e9e7c4d8f3e1ab28fa66d.zip |
BER: Eliminate dialyzer warning for encoding of BIT STRINGs
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_ber_bin_v2.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_gen_ber_bin_v2.erl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl b/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl index c78b164466..9cb343629d 100644 --- a/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl +++ b/lib/asn1/src/asn1ct_gen_ber_bin_v2.erl @@ -175,6 +175,12 @@ gen_encode_user(Erules, #typedef{}=D, Wrapper) -> gen_encode_prim(_Erules, #type{}=D, DoTag, Value) -> BitStringConstraint = get_size_constraint(D#type.constraint), + MaxBitStrSize = case BitStringConstraint of + [] -> none; + {_,'MAX'} -> none; + {_,Max} -> Max; + Max when is_integer(Max) -> Max + end, asn1ct_name:new(enumval), Type = case D#type.def of 'OCTET STRING' -> restricted_string; @@ -220,11 +226,11 @@ gen_encode_prim(_Erules, #type{}=D, DoTag, Value) -> "end"]); {'BIT STRING',[]} -> case asn1ct:use_legacy_types() of - false when BitStringConstraint =:= [] -> + false when MaxBitStrSize =:= none -> call(encode_unnamed_bit_string, [Value,DoTag]); false -> call(encode_unnamed_bit_string, - [{asis,BitStringConstraint},Value,DoTag]); + [{asis,MaxBitStrSize},Value,DoTag]); true -> call(encode_bit_string, [{asis,BitStringConstraint},Value, @@ -232,12 +238,12 @@ gen_encode_prim(_Erules, #type{}=D, DoTag, Value) -> end; {'BIT STRING',NamedNumberList} -> case asn1ct:use_legacy_types() of - false when BitStringConstraint =:= [] -> + false when MaxBitStrSize =:= none -> call(encode_named_bit_string, [Value,{asis,NamedNumberList},DoTag]); false -> call(encode_named_bit_string, - [{asis,BitStringConstraint},Value, + [{asis,MaxBitStrSize},Value, {asis,NamedNumberList},DoTag]); true -> call(encode_bit_string, |