fix NULL args in grapheme_break_stateful
This commit is contained in:
parent
df2997a300
commit
8239639e3f
7
NEWS.md
7
NEWS.md
@ -1,5 +1,12 @@
|
|||||||
# utf8proc release history #
|
# utf8proc release history #
|
||||||
|
|
||||||
|
## Version 2.6.1 ##
|
||||||
|
|
||||||
|
2020-12-15
|
||||||
|
|
||||||
|
- Bugfix in `utf8proc_grapheme_break_stateful` for `NULL` state argument, which
|
||||||
|
also broke `utf8proc_grapheme_break`.
|
||||||
|
|
||||||
## Version 2.6 ##
|
## Version 2.6 ##
|
||||||
|
|
||||||
2020-11-23
|
2020-11-23
|
||||||
|
|||||||
@ -118,6 +118,9 @@ int main(int argc, char **argv)
|
|||||||
checkline("/ 1f926 1f3fc 200d 2642 fe0f /", true); /* facepalm + pale skin + zwj + male sign + FE0F */
|
checkline("/ 1f926 1f3fc 200d 2642 fe0f /", true); /* facepalm + pale skin + zwj + male sign + FE0F */
|
||||||
checkline("/ 1f468 1f3fb 200d 1f91d 200d 1f468 1f3fd /", true); /* man face + pale skin + zwj + hand holding + zwj + man face + dark skin */
|
checkline("/ 1f468 1f3fb 200d 1f91d 200d 1f468 1f3fd /", true); /* man face + pale skin + zwj + hand holding + zwj + man face + dark skin */
|
||||||
|
|
||||||
|
check(utf8proc_grapheme_break(0x03b1, 0x03b2), "failed 03b1 / 03b2 test");
|
||||||
|
check(!utf8proc_grapheme_break(0x03b1, 0x0302), "failed 03b1 0302 test");
|
||||||
|
|
||||||
printf("Passed regression tests!\n");
|
printf("Passed regression tests!\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -290,13 +290,14 @@ static utf8proc_bool grapheme_break_simple(int lbc, int tbc) {
|
|||||||
|
|
||||||
static utf8proc_bool grapheme_break_extended(int lbc, int tbc, utf8proc_int32_t *state)
|
static utf8proc_bool grapheme_break_extended(int lbc, int tbc, utf8proc_int32_t *state)
|
||||||
{
|
{
|
||||||
|
if (state) {
|
||||||
int lbc_override;
|
int lbc_override;
|
||||||
if (*state == UTF8PROC_BOUNDCLASS_START)
|
if (*state == UTF8PROC_BOUNDCLASS_START)
|
||||||
*state = lbc_override = lbc;
|
*state = lbc_override = lbc;
|
||||||
else
|
else
|
||||||
lbc_override = *state;
|
lbc_override = *state;
|
||||||
utf8proc_bool break_permitted = grapheme_break_simple(lbc_override, tbc);
|
utf8proc_bool break_permitted = grapheme_break_simple(lbc_override, tbc);
|
||||||
if (state) {
|
|
||||||
// Special support for GB 12/13 made possible by GB999. After two RI
|
// Special support for GB 12/13 made possible by GB999. After two RI
|
||||||
// class codepoints we want to force a break. Do this by resetting the
|
// class codepoints we want to force a break. Do this by resetting the
|
||||||
// second RI's bound class to UTF8PROC_BOUNDCLASS_OTHER, to force a break
|
// second RI's bound class to UTF8PROC_BOUNDCLASS_OTHER, to force a break
|
||||||
@ -315,8 +316,11 @@ static utf8proc_bool grapheme_break_extended(int lbc, int tbc, utf8proc_int32_t
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
*state = tbc;
|
*state = tbc;
|
||||||
}
|
|
||||||
return break_permitted;
|
return break_permitted;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return grapheme_break_simple(lbc, tbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_grapheme_break_stateful(
|
UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_grapheme_break_stateful(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user