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)
341341
342342 for (size_t index = 0 ; index < sSize ;)
343343 {
344- if (sData [index] > 0 )
344+ if (sData [index] >= 0 )
345345 {
346346 // use fast inner loop to skip single byte code points (which are
347347 // expected to be the most frequent)
348- while ((++index < sSize ) && (sData [index] > 0 ))
348+ while ((++index < sSize ) && (sData [index] >= 0 ))
349349 ;
350350
351351 if (index >= sSize ) break ;
Original file line number Diff line number Diff line change @@ -153,6 +153,14 @@ SUITE(strings)
153153 auto result = utility::conversions::utf8_to_utf16 (input);
154154 VERIFY_ARE_EQUAL (0x7F , result[0 ]);
155155
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+
156164 // 2 byte character
157165 input.clear ();
158166 // U+80
You can’t perform that action at this time.
0 commit comments