* The collect_a_seq() function checks on the given string s, collect * a sequence of characters at u8s, and return the sequence. While it collects * a sequence, it also applies case conversion, canonical or compatibility * decomposition, canonical decomposition, or some or all of them and * in that order. * * The collected sequence cannot be bigger than 32 characters since if * it is having
| 1373 | * null byte. |
| 1374 | */ |
| 1375 | static size_t |
| 1376 | collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast, |
| 1377 | boolean_t is_it_toupper, boolean_t is_it_tolower, |
| 1378 | boolean_t canonical_decomposition, boolean_t compatibility_decomposition, |
| 1379 | boolean_t canonical_composition, |
| 1380 | int *errnum, u8_normalization_states_t *state) |
| 1381 | { |
| 1382 | uchar_t *s; |
| 1383 | int sz; |
| 1384 | int saved_sz; |
| 1385 | size_t i; |
| 1386 | size_t j; |
| 1387 | size_t k; |
| 1388 | size_t l; |
| 1389 | uchar_t comb_class[U8_MAX_CHARS_A_SEQ]; |
| 1390 | uchar_t disp[U8_MAX_CHARS_A_SEQ]; |
| 1391 | uchar_t start[U8_MAX_CHARS_A_SEQ]; |
| 1392 | uchar_t u8t[U8_MB_CUR_MAX] = { '\0' }; |
| 1393 | uchar_t uts[U8_STREAM_SAFE_TEXT_MAX + 1]; |
| 1394 | uchar_t tc; |
| 1395 | size_t last; |
| 1396 | size_t saved_last; |
| 1397 | uint32_t u1; |
| 1398 | |
| 1399 | /* |
| 1400 | * Save the source string pointer which we will return a changed |
| 1401 | * pointer if we do processing. |
| 1402 | */ |
| 1403 | s = *source; |
| 1404 | |
| 1405 | /* |
| 1406 | * The following is a fallback for just in case callers are not |
| 1407 | * checking the string boundaries before the calling. |
| 1408 | */ |
| 1409 | if (s >= slast) { |
| 1410 | u8s[0] = '\0'; |
| 1411 | |
| 1412 | return (0); |
| 1413 | } |
| 1414 | |
| 1415 | /* |
| 1416 | * As the first thing, let's collect a character and do case |
| 1417 | * conversion if necessary. |
| 1418 | */ |
| 1419 | |
| 1420 | sz = u8_number_of_bytes[*s]; |
| 1421 | |
| 1422 | if (sz < 0) { |
| 1423 | *errnum = EILSEQ; |
| 1424 | |
| 1425 | u8s[0] = *s++; |
| 1426 | u8s[1] = '\0'; |
| 1427 | |
| 1428 | *source = s; |
| 1429 | |
| 1430 | return (1); |
| 1431 | } |
| 1432 |
no test coverage detected