diff options
author | Björn Gustavsson <[email protected]> | 2013-01-21 16:04:39 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-01-23 15:22:56 +0100 |
commit | 79c59e5d6199ca3410d97aac47bac3be4f5d3089 (patch) | |
tree | 24ad974b42d7b3704efa438a1db8005c952e55c8 /lib/asn1/src/asn1ct_gen_per.erl | |
parent | 392d295030b63d161b7b035faeb0e5f8797474f1 (diff) | |
download | otp-79c59e5d6199ca3410d97aac47bac3be4f5d3089.tar.gz otp-79c59e5d6199ca3410d97aac47bac3be4f5d3089.tar.bz2 otp-79c59e5d6199ca3410d97aac47bac3be4f5d3089.zip |
per,uper: Optimize decoding of the string data types
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_per.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_gen_per.erl | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl index b38af3306a..25b0d46295 100644 --- a/lib/asn1/src/asn1ct_gen_per.erl +++ b/lib/asn1/src/asn1ct_gen_per.erl @@ -1131,6 +1131,22 @@ gen_dec_imm_1({'INTEGER',NamedNumberList}, Constraint, Aligned) -> asn1ct_imm:per_dec_named_integer(Constraint, NamedNumberList, Aligned); +gen_dec_imm_1('BMPString'=Type, Constraint, Aligned) -> + gen_dec_k_m_string(Type, Constraint, Aligned); +gen_dec_imm_1('NumericString'=Type, Constraint, Aligned) -> + gen_dec_k_m_string(Type, Constraint, Aligned); +gen_dec_imm_1('PrintableString'=Type, Constraint, Aligned) -> + gen_dec_k_m_string(Type, Constraint, Aligned); +gen_dec_imm_1('VisibleString'=Type, Constraint, Aligned) -> + gen_dec_k_m_string(Type, Constraint, Aligned); +gen_dec_imm_1('IA5String'=Type, Constraint, Aligned) -> + gen_dec_k_m_string(Type, Constraint, Aligned); +gen_dec_imm_1('UniversalString'=Type, Constraint, Aligned) -> + gen_dec_k_m_string(Type, Constraint, Aligned); +gen_dec_imm_1('UTCTime', Constraint, Aligned) -> + gen_dec_k_m_string('VisibleString', Constraint, Aligned); +gen_dec_imm_1('GeneralizedTime', Constraint, Aligned) -> + gen_dec_k_m_string('VisibleString', Constraint, Aligned); gen_dec_imm_1('OCTET STRING', Constraint, Aligned) -> SzConstr = get_constraint(Constraint, 'SizeConstraint'), Imm = asn1ct_imm:per_dec_octet_string(SzConstr, Aligned), @@ -1151,6 +1167,9 @@ gen_dec_copy_bitstring(Imm) -> end, {call,D,Imm}. +gen_dec_k_m_string(Type, Constraint, Aligned) -> + asn1ct_imm:per_dec_k_m_string(Type, Constraint, Aligned). + gen_dec_prim(Erule, Type, BytesVar) -> case gen_dec_imm(Erule, Type) of no -> @@ -1171,9 +1190,6 @@ gen_dec_prim_1(Erule, call(Erule, decode_relative_oid, [BytesVar]); 'ObjectDescriptor' -> call(Erule, decode_ObjectDescriptor, [BytesVar]); - 'NumericString' -> - call(Erule, decode_NumericString, - [BytesVar,{asis,Constraint}]); TString when TString == 'TeletexString'; TString == 'T61String' -> call(Erule, decode_TeletexString, @@ -1181,27 +1197,10 @@ gen_dec_prim_1(Erule, 'VideotexString' -> call(Erule, decode_VideotexString, [BytesVar,{asis,Constraint}]); - 'UTCTime' -> - call(Erule, decode_VisibleString, [BytesVar,{asis,Constraint}]); - 'GeneralizedTime' -> - call(Erule, decode_VisibleString, [BytesVar,{asis,Constraint}]); 'GraphicString' -> call(Erule, decode_GraphicString,[BytesVar,{asis,Constraint}]); - 'VisibleString' -> - call(Erule, decode_VisibleString, [BytesVar,{asis,Constraint}]); 'GeneralString' -> call(Erule, decode_GeneralString, [BytesVar,{asis,Constraint}]); - 'PrintableString' -> - call(Erule, decode_PrintableString, - [BytesVar,{asis,Constraint}]); - 'IA5String' -> - call(Erule, decode_IA5String, [BytesVar,{asis,Constraint}]); - 'BMPString' -> - call(Erule, decode_BMPString, - [BytesVar,{asis,Constraint}]); - 'UniversalString' -> - call(Erule, decode_UniversalString, - [BytesVar,{asis,Constraint}]); 'UTF8String' -> call(Erule, decode_UTF8String, [BytesVar]); #'ObjectClassFieldType'{} -> |