18
18
19
19
#include " unescape_string.h"
20
20
21
- std::basic_string<unsigned int > convert_one_string_literal (
22
- const std::string &src)
21
+ std::basic_string<char32_t > convert_one_string_literal (const std::string &src)
23
22
{
24
23
PRECONDITION (src.size () >= 2 );
25
24
@@ -28,8 +27,8 @@ std::basic_string<unsigned int> convert_one_string_literal(
28
27
PRECONDITION (src[src.size () - 1 ] == ' "' );
29
28
PRECONDITION (src[2 ] == ' "' );
30
29
31
- std::basic_string<unsigned int > value=
32
- unescape_wide_string (std::string (src, 3 , src.size ()- 4 ));
30
+ std::basic_string<char32_t > value =
31
+ unescape_wide_string (std::string (src, 3 , src.size () - 4 ));
33
32
34
33
// turn into utf-8
35
34
const std::string utf8_value = utf32_native_endian_to_utf8 (value);
@@ -57,7 +56,7 @@ std::basic_string<unsigned int> convert_one_string_literal(
57
56
unescape_string (std::string (src, 1 , src.size ()-2 ));
58
57
59
58
// pad into wide string
60
- std::basic_string<unsigned int > value;
59
+ std::basic_string<char32_t > value;
61
60
value.resize (char_value.size ());
62
61
for (std::size_t i=0 ; i<char_value.size (); i++)
63
62
value[i]=char_value[i];
@@ -72,7 +71,7 @@ exprt convert_string_literal(const std::string &src)
72
71
// e.g., something like "asd" "xyz".
73
72
// GCC allows "asd" L"xyz"!
74
73
75
- std::basic_string<unsigned int > value;
74
+ std::basic_string<char32_t > value;
76
75
77
76
char wide =0 ;
78
77
@@ -101,8 +100,7 @@ exprt convert_string_literal(const std::string &src)
101
100
INVARIANT (j < src.size (), " non-terminated string constant '" + src + " '" );
102
101
103
102
std::string tmp_src=std::string (src, i, j-i+1 );
104
- std::basic_string<unsigned int > tmp_value=
105
- convert_one_string_literal (tmp_src);
103
+ std::basic_string<char32_t > tmp_value = convert_one_string_literal (tmp_src);
106
104
value.append (tmp_value);
107
105
i=j;
108
106
}
0 commit comments