X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=internals%2F_PDCLIB_encoding.h;h=10f1140c3e73527670d08ab20c246a4ce9572d27;hp=f4b837fd6f631f948201759f33d7c1749d9eee4e;hb=276f7e69f80ac53bfb5da5cc24072dd393485106;hpb=f5b0da3a0376b05783c3182faae3592c22ea74ae diff --git a/internals/_PDCLIB_encoding.h b/internals/_PDCLIB_encoding.h index f4b837f..10f1140 100644 --- a/internals/_PDCLIB_encoding.h +++ b/internals/_PDCLIB_encoding.h @@ -75,18 +75,18 @@ static inline _PDCLIB_size_t _PDCLIB_c32rtoc16( return 1; } else { // Supplementary plane character - *out = 0xD800 | (*in & 0x3FF); + *out = 0xD800 | (*in >> 10); if(bufsize >= 2) { - out[1] = 0xDC00 | (*in >> 10); + out[1] = 0xDC00 | (*in & 0x3FF); return 2; } else { - ps->_Surrogate = 0xDC00 | (*in >> 10); + ps->_Surrogate = 0xDC00 | (*in & 0x3FF); return 1; } } } -struct _PDCLIB_charcodec { +struct _PDCLIB_charcodec_t { /* Reads at most *_P_insz code units from *_P_inbuf and writes the result * into *_P_outbuf, writing at most *_P_outsz code units. Updates * *_P_outbuf, *_P_outsz, *_P_inbuf, *_P_outsz with the resulting state @@ -99,6 +99,9 @@ struct _PDCLIB_charcodec { * encountered), else return false. */ + /* mbsinit. Mandatory. */ + _PDCLIB_bool (*__mbsinit)(const _PDCLIB_mbstate_t *_P_ps); + /* UCS-4 variants. Mandatory. */ _PDCLIB_bool (*__mbstoc32s)(