aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1/asn1_str.cpp
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-03-06 11:33:09 +0100
committerDaniel Neus <[email protected]>2016-03-06 11:33:09 +0100
commit464e9eccbb61738582f85a81dd4b586bd3d6898e (patch)
treeb7fac2f6ef79557f55de1213016e0e576ec5ea28 /src/lib/asn1/asn1_str.cpp
parentc4e5802112b4000950aca376ca13cd125085a177 (diff)
parent027733a7d7ae44e8eb0c96cef371ba592f4cd386 (diff)
Merge branch 'master' into clang-analyzer
Diffstat (limited to 'src/lib/asn1/asn1_str.cpp')
-rw-r--r--src/lib/asn1/asn1_str.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/asn1/asn1_str.cpp b/src/lib/asn1/asn1_str.cpp
index 809448888..c378d5dfe 100644
--- a/src/lib/asn1/asn1_str.cpp
+++ b/src/lib/asn1/asn1_str.cpp
@@ -62,9 +62,8 @@ ASN1_Tag choose_encoding(const std::string& str,
/*
* Create an ASN1_String
*/
-ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_tag(t)
+ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_iso_8859_str(Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET)), m_tag(t)
{
- m_iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
if(m_tag == DIRECTORY_STRING)
m_tag = choose_encoding(m_iso_8859_str, "latin1");
@@ -83,11 +82,8 @@ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_tag(t)
/*
* Create an ASN1_String
*/
-ASN1_String::ASN1_String(const std::string& str)
- {
- m_iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
- m_tag = choose_encoding(m_iso_8859_str, "latin1");
- }
+ASN1_String::ASN1_String(const std::string& str) : m_iso_8859_str(Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET)), m_tag(choose_encoding(m_iso_8859_str, "latin1"))
+ {}
/*
* Return this string in ISO 8859-1 encoding
@@ -141,7 +137,7 @@ void ASN1_String::decode_from(BER_Decoder& source)
charset_is = LATIN1_CHARSET;
*this = ASN1_String(
- Charset::transcode(ASN1::to_string(obj), charset_is, LOCAL_CHARSET),
+ Charset::transcode(ASN1::to_string(obj), LOCAL_CHARSET, charset_is),
obj.type_tag);
}