@@ -142,7 +142,7 @@ class JSON_Parser
142
142
143
143
virtual bool CompleteComment (Token &token);
144
144
virtual bool CompleteStringLiteral (Token &token);
145
- int convert_unicode_to_code_point (Token &token );
145
+ int convert_unicode_to_code_point ();
146
146
bool handle_unescape_char (Token &token);
147
147
148
148
private:
@@ -693,6 +693,14 @@ bool JSON_StringParser<CharType>::CompleteComment(typename JSON_Parser<CharType>
693
693
return true ;
694
694
}
695
695
696
+ void convert_append_unicode_code_unit (JSON_Parser<wchar_t >::Token &token, utf16string value)
697
+ {
698
+ token.string_val .append (value);
699
+ }
700
+ void convert_append_unicode_code_unit (JSON_Parser<char >::Token &token, utf16string value)
701
+ {
702
+ token.string_val .append (::utility::conversions::utf16_to_utf8 (value));
703
+ }
696
704
void convert_append_unicode_code_unit (JSON_Parser<wchar_t >::Token &token, utf16char value)
697
705
{
698
706
token.string_val .push_back (value);
@@ -704,7 +712,7 @@ void convert_append_unicode_code_unit(JSON_Parser<char>::Token &token, utf16char
704
712
}
705
713
706
714
template <typename CharType>
707
- int JSON_Parser<CharType>::convert_unicode_to_code_point(Token &token )
715
+ int JSON_Parser<CharType>::convert_unicode_to_code_point()
708
716
{
709
717
// A four-hexdigit Unicode character.
710
718
// Transform into a 16 bit code point.
@@ -769,7 +777,7 @@ inline bool JSON_Parser<CharType>::handle_unescape_char(Token &token)
769
777
return true ;
770
778
case ' u' :
771
779
{
772
- int decoded = convert_unicode_to_code_point (token );
780
+ int decoded = convert_unicode_to_code_point ();
773
781
if (decoded == -1 )
774
782
{
775
783
return false ;
@@ -780,11 +788,11 @@ inline bool JSON_Parser<CharType>::handle_unescape_char(Token &token)
780
788
{
781
789
// skip escape character
782
790
NextCharacter (); NextCharacter ();
783
- int decoded2 = convert_unicode_to_code_point (token );
791
+ int decoded2 = convert_unicode_to_code_point ();
784
792
785
793
utf16string compoundUTF16 = { static_cast <utf16char>(decoded),
786
794
static_cast <utf16char>(decoded2) };
787
- token. string_val . append (:: utility::conversions::utf16_to_utf8 ( compoundUTF16) );
795
+ convert_append_unicode_code_unit (token, compoundUTF16);
788
796
}
789
797
else
790
798
{
0 commit comments