File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -341,11 +341,11 @@ inline size_t count_utf8_to_utf16(const std::string& s)
341
341
342
342
for (size_t index = 0 ; index < sSize ;)
343
343
{
344
- if (sData [index] > 0 )
344
+ if (sData [index] >= 0 )
345
345
{
346
346
// use fast inner loop to skip single byte code points (which are
347
347
// expected to be the most frequent)
348
- while ((++index < sSize ) && (sData [index] > 0 ))
348
+ while ((++index < sSize ) && (sData [index] >= 0 ))
349
349
;
350
350
351
351
if (index >= sSize ) break ;
Original file line number Diff line number Diff line change @@ -153,6 +153,14 @@ SUITE(strings)
153
153
auto result = utility::conversions::utf8_to_utf16 (input);
154
154
VERIFY_ARE_EQUAL (0x7F , result[0 ]);
155
155
156
+ // null byte
157
+ input.clear ();
158
+ input.push_back (0 );
159
+ input.push_back (0 );
160
+ result = utility::conversions::utf8_to_utf16 (input);
161
+ VERIFY_ARE_EQUAL (0 , result[0 ]);
162
+ VERIFY_ARE_EQUAL (0 , result[1 ]);
163
+
156
164
// 2 byte character
157
165
input.clear ();
158
166
// U+80
You can’t perform that action at this time.
0 commit comments