File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ class simplecpp::TokenList::Stream {
230
230
// character is non-ASCII character then replace it with 0xff
231
231
if (isUtf16) {
232
232
const unsigned char ch2 = static_cast <unsigned char >(get ());
233
- const int ch16 = (bom == 0xfeff ) ? (ch<< 8 | ch2) : (ch2<< 8 | ch );
233
+ const int ch16 = makeUtf16Char (ch, ch2);
234
234
ch = static_cast <unsigned char >(((ch16 >= 0x80 ) ? 0xff : ch16));
235
235
}
236
236
@@ -242,7 +242,7 @@ class simplecpp::TokenList::Stream {
242
242
else if (isUtf16) {
243
243
const int c1 = get ();
244
244
const int c2 = get ();
245
- const int ch16 = (bom == 0xfeff ) ? (c1<< 8 | c2) : (c2<< 8 | c1 );
245
+ const int ch16 = makeUtf16Char (c1, c2 );
246
246
if (ch16 != ' \n ' ) {
247
247
unget ();
248
248
unget ();
@@ -263,7 +263,7 @@ class simplecpp::TokenList::Stream {
263
263
(void )get ();
264
264
const unsigned char ch2 = static_cast <unsigned char >(peek ());
265
265
unget ();
266
- const int ch16 = (bom == 0xfeff ) ? (ch<< 8 | ch2) : (ch2<< 8 | ch );
266
+ const int ch16 = makeUtf16Char (ch, ch2);
267
267
ch = static_cast <unsigned char >(((ch16 >= 0x80 ) ? 0xff : ch16));
268
268
}
269
269
@@ -288,6 +288,11 @@ class simplecpp::TokenList::Stream {
288
288
}
289
289
290
290
private:
291
+ inline int makeUtf16Char (const unsigned char ch, const unsigned char ch2) const
292
+ {
293
+ return (bom == 0xfeff ) ? (ch<<8 | ch2) : (ch2<<8 | ch);
294
+ }
295
+
291
296
unsigned short getAndSkipBOM ()
292
297
{
293
298
const int ch1 = peek ();
You can’t perform that action at this time.
0 commit comments