aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1_str.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-19 09:39:54 +0000
committerlloyd <[email protected]>2006-06-19 09:39:54 +0000
commitdad5f59194f8d153af423461c1fd20cebfc6661e (patch)
treec20af96e5c07802c7edede210edec2bdd9a45794 /src/asn1_str.cpp
parent93f89be401584e25a1ce182ac5f0bd6b2cab947f (diff)
Inline the convert_string function
Diffstat (limited to 'src/asn1_str.cpp')
-rw-r--r--src/asn1_str.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/asn1_str.cpp b/src/asn1_str.cpp
index 3d1233b6b..e6125f00f 100644
--- a/src/asn1_str.cpp
+++ b/src/asn1_str.cpp
@@ -133,37 +133,25 @@ void ASN1_String::encode_into(DER_Encoder& encoder) const
encoder.add_object(tagging(), UNIVERSAL, value);
}
-namespace {
-
/*************************************************
-* Do any UTF-8/Unicode decoding needed *
+* Decode a BER encoded ASN1_String *
*************************************************/
-// FIXME: inline this
-std::string convert_string(BER_Object obj, ASN1_Tag type)
+void ASN1_String::decode_from(BER_Decoder& source)
{
+ BER_Object obj = source.get_next_object();
+
Character_Set charset_is;
- if(type == BMP_STRING)
+ if(obj.type_tag == BMP_STRING)
charset_is = UCS2_CHARSET;
- else if(type == UTF8_STRING)
+ else if(obj.type_tag == UTF8_STRING)
charset_is = UTF8_CHARSET;
else
charset_is = LATIN1_CHARSET;
- return Charset::transcode(ASN1::to_string(obj),
- charset_is, LOCAL_CHARSET);
- }
-
-}
-
-/*************************************************
-* Decode a BER encoded ASN1_String *
-*************************************************/
-void ASN1_String::decode_from(BER_Decoder& source)
- {
- BER_Object obj = source.get_next_object();
- // FIXME, don't like this at all...
- *this = ASN1_String(convert_string(obj, obj.type_tag), obj.type_tag);
+ *this = ASN1_String(
+ Charset::transcode(ASN1::to_string(obj), charset_is, LOCAL_CHARSET),
+ obj.type_tag);
}
}