diff options
author | René Meusel <[email protected]> | 2017-11-08 11:20:09 +0100 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-11-09 16:05:18 -0500 |
commit | 54baf3a3d3ee070e3740859298f92d69b042c9c6 (patch) | |
tree | c3b9b2ca895246d0c2853180c1a279b472a34ebf /src/lib/asn1 | |
parent | a27772c069f511e4277bde84349fb24a93f39d53 (diff) |
FIX: linker error on windows (VSO#143857)
Diffstat (limited to 'src/lib/asn1')
-rw-r--r-- | src/lib/asn1/asn1_str.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/asn1/asn1_str.cpp b/src/lib/asn1/asn1_str.cpp index e9cc8ccdc..070acbebd 100644 --- a/src/lib/asn1/asn1_str.cpp +++ b/src/lib/asn1/asn1_str.cpp @@ -149,17 +149,29 @@ void ASN1_String::decode_from(BER_Decoder& source) { BER_Object obj = source.get_next_object(); +#if defined(BOTAN_TARGET_OS_TYPE_IS_WINDOWS) + // using char32_t and char16_t (as suggested by the standard) leads to linker + // errors on MSVC 2015 and 2017. This workaround was suggested here: + // https://social.msdn.microsoft.com/Forums/vstudio/en-US/ + // 8f40dcd8-c67f-4eba-9134-a19b9178e481/vs-2015-rc-linker-stdcodecvt-error + using utf32_type = int32_t; + using utf16_type = wchar_t; +#else + using utf32_type = char32_t; + using utf16_type = char16_t; +#endif + if(obj.type_tag == UTF8_STRING) { *this = ASN1_String(ASN1::to_string(obj), obj.type_tag); } else if(obj.type_tag == BMP_STRING) { - *this = ASN1_String(ucsX_to_utf8<char16_t>(obj.value), obj.type_tag); + *this = ASN1_String(ucsX_to_utf8<utf16_type>(obj.value), obj.type_tag); } else if(obj.type_tag == UNIVERSAL_STRING) { - *this = ASN1_String(ucsX_to_utf8<char32_t>(obj.value), obj.type_tag); + *this = ASN1_String(ucsX_to_utf8<utf32_type>(obj.value), obj.type_tag); } else // IA5_STRING - international ASCII characters // T61_STRING - pretty much ASCII |