X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=blobdiff_plain;f=opt%2Fbasecodecs%2F_PDCLIB_utf8.c;h=a93454194fb04ea3a845168351a0ee86df2a46e8;hp=bac0e824a7f9b5a1d0b662058778f32f34eceb79;hb=af0bf7d39ae3e433be81a69ea3c5d418814de4a0;hpb=d3518c4a254034218c5c0e14ff7a154091100b7a diff --git a/opt/basecodecs/_PDCLIB_utf8.c b/opt/basecodecs/_PDCLIB_utf8.c index bac0e82..a934541 100644 --- a/opt/basecodecs/_PDCLIB_utf8.c +++ b/opt/basecodecs/_PDCLIB_utf8.c @@ -17,6 +17,9 @@ * _St32[1] is the character accumulated so far */ +static bool utf8_mbsinit( const mbstate_t *p_s ) +{ return p_s->_StUC[0] == 0; } + enum { DecStart = 0, @@ -52,6 +55,7 @@ end_conversion: \ _PDCLIB_UNDEFINED(accum); \ state = DecStart; \ } while(0) + #define CHECK_CONTINUATION \ do { if((c & 0xC0) != 0x80) return false; } while(0) @@ -229,6 +233,7 @@ static bool c32toutf8( } struct _PDCLIB_charcodec _PDCLIB_utf8_codec = { + .__mbsinit = utf8_mbsinit, .__mbstoc32s = utf8toc32, .__c32stombs = c32toutf8, .__mb_max = 4,