Skip to content

Commit

Permalink
Fix bugs in the utf-8 parser
Browse files Browse the repository at this point in the history
  • Loading branch information
bbonev committed Jul 8, 2022
1 parent 383509d commit 1375ee1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ucell.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ inline int ucell_utf_feed(ucell *uc,uint8_t c) { // {{{
if ((c&0xc0)==0x80) { // continuation byte
ucell_utf_feed2(uc,uc->utf[0],c);
uc->utfst=U_NORM;
break;
return 2;
}
if (c&0x80) // start another sequence
goto startbyte;
Expand All @@ -409,9 +409,8 @@ inline int ucell_utf_feed(ucell *uc,uint8_t c) { // {{{
case U_L3C2:
if ((c&0xc0)==0x80) { // continuation byte
ucell_utf_feed3(uc,uc->utf[0],uc->utf[1],c);
return 3;
uc->utfst=U_NORM;
break;
return 3;
}
if (c&0x80) // start another sequence
goto startbyte;
Expand Down Expand Up @@ -443,9 +442,8 @@ inline int ucell_utf_feed(ucell *uc,uint8_t c) { // {{{
case U_L4C3:
if ((c&0xc0)==0x80) { // continuation byte
ucell_utf_feed4(uc,uc->utf[0],uc->utf[1],uc->utf[2],c);
return 4;
uc->utfst=U_NORM;
break;
return 4;
}
if (c&0x80) // start another sequence
goto startbyte;
Expand Down

0 comments on commit 1375ee1

Please sign in to comment.