Skip to content

Commit de53013

Browse files
committed
libast: utf8_mbtowc(): Fix utf8tab to match new type (re: ccc707c)
Given this: if ((m = utf8tab[*sp]) > 0) it was not correct to change the type of m to size_t because that's an unsigned type, while utf8tab[] contains two final entries of -1. However, since utf8_mbtowc otherwise treats -1 exactly the same way as 0, and nothing else uses that table, it's enough just to change those values to 0.
1 parent ccc707c commit de53013

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/libast/comp/setlocale.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static const uint32_t utf8mask[] =
484484
0xfc000000,
485485
};
486486

487-
static const signed char utf8tab[256] =
487+
static const unsigned char utf8tab[256] =
488488
{
489489
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
490490
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -501,7 +501,7 @@ static const signed char utf8tab[256] =
501501
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502502
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503503
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
504-
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,-1,-1,
504+
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0,
505505
};
506506

507507
static int

0 commit comments

Comments
 (0)