#include <stdint.h>
#include <uchar.h>
#include <assert.h>
-#include <_PDCLIB_encoding.h>
+#include "_PDCLIB_encoding.h"
/* Use of the mbstate:
*
char32_t c32;
switch(state) {
case DecStart:
- // 1 byte
+ // 1 byte
if(c <= 0x7F) {
OUT32(c);
} else if(c <= 0xDF) {
}
(*p_inbuf)++;
- (*p_insz)--;
+ (*p_insz)--;
}
END_CONVERSION;
}
{
START_CONVERSION
while(*p_outsz) {
- unsigned char outc;
+ unsigned char outc = 0;
switch(state) {
case Enc3R:
outc = 0x80 | ((accum >> 12) & 0x3F);
if(p_outbuf) {
**p_outbuf = outc;
- (*p_outbuf)++;
+ (*p_outbuf)++;
}
- (*p_outsz)--;
+ (*p_outsz)--;
}
END_CONVERSION;
}
-const struct _PDCLIB_charcodec _PDCLIB_utf8_codec = {
+const struct _PDCLIB_charcodec_t _PDCLIB_utf8_codec = {
.__mbsinit = utf8_mbsinit,
.__mbstoc32s = utf8toc32,
.__c32stombs = c32toutf8,
#endif
#ifdef TEST
-#include <_PDCLIB_test.h>
+#include "_PDCLIB_test.h"
int main( void )
{
#ifndef REGTEST
// Valid conversion & back
- static const char* input = "abcde" "\xDF\xBF" "\xEF\xBF\xBF"
+ static const char* input = "abcde" "\xDF\xBF" "\xEF\xBF\xBF"
"\xF4\x8F\xBF\xBF";
char32_t c32out[8];