@@ -46,27 +46,27 @@ class JSONUTF8StringFilter
46
46
}
47
47
}
48
48
// Write codepoint directly, possibly collating surrogate pairs
49
- void push_back_u (unsigned int codepoint )
49
+ void push_back_u (unsigned int codepoint_ )
50
50
{
51
51
if (state) // Only accept full codepoints in open state
52
52
is_valid = false ;
53
- if (codepoint >= 0xD800 && codepoint < 0xDC00 ) { // First half of surrogate pair
53
+ if (codepoint_ >= 0xD800 && codepoint_ < 0xDC00 ) { // First half of surrogate pair
54
54
if (surpair) // Two subsequent surrogate pair openers - fail
55
55
is_valid = false ;
56
56
else
57
- surpair = codepoint ;
58
- } else if (codepoint >= 0xDC00 && codepoint < 0xE000 ) { // Second half of surrogate pair
57
+ surpair = codepoint_ ;
58
+ } else if (codepoint_ >= 0xDC00 && codepoint_ < 0xE000 ) { // Second half of surrogate pair
59
59
if (surpair) { // Open surrogate pair, expect second half
60
60
// Compute code point from UTF-16 surrogate pair
61
- append_codepoint (0x10000 | ((surpair - 0xD800 )<<10 ) | (codepoint - 0xDC00 ));
61
+ append_codepoint (0x10000 | ((surpair - 0xD800 )<<10 ) | (codepoint_ - 0xDC00 ));
62
62
surpair = 0 ;
63
63
} else // Second half doesn't follow a first half - fail
64
64
is_valid = false ;
65
65
} else {
66
66
if (surpair) // First half of surrogate pair not followed by second - fail
67
67
is_valid = false ;
68
68
else
69
- append_codepoint (codepoint );
69
+ append_codepoint (codepoint_ );
70
70
}
71
71
}
72
72
// Check that we're in a state where the string can be ended
@@ -96,22 +96,22 @@ class JSONUTF8StringFilter
96
96
// Two subsequent \u.... may have to be replaced with one actual codepoint.
97
97
unsigned int surpair; // First half of open UTF-16 surrogate pair, or 0
98
98
99
- void append_codepoint (unsigned int codepoint )
99
+ void append_codepoint (unsigned int codepoint_ )
100
100
{
101
- if (codepoint <= 0x7f )
102
- str.push_back ((char )codepoint );
103
- else if (codepoint <= 0x7FF ) {
104
- str.push_back ((char )(0xC0 | (codepoint >> 6 )));
105
- str.push_back ((char )(0x80 | (codepoint & 0x3F )));
106
- } else if (codepoint <= 0xFFFF ) {
107
- str.push_back ((char )(0xE0 | (codepoint >> 12 )));
108
- str.push_back ((char )(0x80 | ((codepoint >> 6 ) & 0x3F )));
109
- str.push_back ((char )(0x80 | (codepoint & 0x3F )));
110
- } else if (codepoint <= 0x1FFFFF ) {
111
- str.push_back ((char )(0xF0 | (codepoint >> 18 )));
112
- str.push_back ((char )(0x80 | ((codepoint >> 12 ) & 0x3F )));
113
- str.push_back ((char )(0x80 | ((codepoint >> 6 ) & 0x3F )));
114
- str.push_back ((char )(0x80 | (codepoint & 0x3F )));
101
+ if (codepoint_ <= 0x7f )
102
+ str.push_back ((char )codepoint_ );
103
+ else if (codepoint_ <= 0x7FF ) {
104
+ str.push_back ((char )(0xC0 | (codepoint_ >> 6 )));
105
+ str.push_back ((char )(0x80 | (codepoint_ & 0x3F )));
106
+ } else if (codepoint_ <= 0xFFFF ) {
107
+ str.push_back ((char )(0xE0 | (codepoint_ >> 12 )));
108
+ str.push_back ((char )(0x80 | ((codepoint_ >> 6 ) & 0x3F )));
109
+ str.push_back ((char )(0x80 | (codepoint_ & 0x3F )));
110
+ } else if (codepoint_ <= 0x1FFFFF ) {
111
+ str.push_back ((char )(0xF0 | (codepoint_ >> 18 )));
112
+ str.push_back ((char )(0x80 | ((codepoint_ >> 12 ) & 0x3F )));
113
+ str.push_back ((char )(0x80 | ((codepoint_ >> 6 ) & 0x3F )));
114
+ str.push_back ((char )(0x80 | (codepoint_ & 0x3F )));
115
115
}
116
116
}
117
117
};
0 commit comments