From f090e030be53e574fecbe7cf50edfb5fdacb53e1 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 19 May 2006 00:07:25 +0000 Subject: Syntax changes to the BER and DER APIs to improve readability of code that uses them. These changes are not backwards compatible, this commit updates all uses of the APIs within the library. --- src/asn1_oid.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/asn1_oid.cpp') diff --git a/src/asn1_oid.cpp b/src/asn1_oid.cpp index 413beedcf..3115c2be5 100644 --- a/src/asn1_oid.cpp +++ b/src/asn1_oid.cpp @@ -4,7 +4,6 @@ *************************************************/ #include -#include #include #include #include @@ -140,12 +139,10 @@ void OID::encode_into(DER_Encoder& der) const der.add_object(OBJECT_ID, UNIVERSAL, encoding); } -namespace BER { - /************************************************* * Decode a BER encoded OBJECT IDENTIFIER * *************************************************/ -void decode(BER_Decoder& decoder, OID& oid) +void OID::decode_from(BER_Decoder& decoder) { BER_Object obj = decoder.get_next_object(); if(obj.type_tag != OBJECT_ID || obj.class_tag != UNIVERSAL) @@ -154,9 +151,10 @@ void decode(BER_Decoder& decoder, OID& oid) if(obj.value.size() < 2) throw BER_Decoding_Error("OID encoding is too short"); - oid.clear(); - oid += (obj.value[0] / 40); - oid += (obj.value[0] % 40); + + clear(); + id.push_back(obj.value[0] / 40); + id.push_back(obj.value[0] % 40); u32bit j = 0; while(j != obj.value.size() - 1) @@ -169,10 +167,8 @@ void decode(BER_Decoder& decoder, OID& oid) if(!(obj.value[j] & 0x80)) break; } - oid += component; + id.push_back(component); } } } - -} -- cgit v1.2.3