Fix error

This commit is contained in:
Alexey Milovidov 2021-01-28 10:16:36 +03:00
parent 9e1c1157b5
commit 355c99568e

View File

@ -103,8 +103,11 @@ public:
/// Invalid UTF-8 /// Invalid UTF-8
if (first_u32 < 0) if (first_u32 < 0)
{ {
l = needle[0]; /// Process it verbatim as a sequence of bytes.
u = needle[0]; size_t src_len = UTF8::seqLength(*needle);
memcpy(l_seq, needle, src_len);
memcpy(u_seq, needle, src_len);
} }
else else
{ {
@ -113,10 +116,11 @@ public:
/// lower and uppercase variants of the first octet of the first character in `needle` /// lower and uppercase variants of the first octet of the first character in `needle`
UTF8::convert(first_l_u32, l_seq, sizeof(l_seq)); UTF8::convert(first_l_u32, l_seq, sizeof(l_seq));
l = l_seq[0];
UTF8::convert(first_u_u32, u_seq, sizeof(u_seq)); UTF8::convert(first_u_u32, u_seq, sizeof(u_seq));
u = u_seq[0];
} }
l = l_seq[0];
u = u_seq[0];
} }
#ifdef __SSE4_1__ #ifdef __SSE4_1__