]> pd.if.org Git - pdclib/blobdiff - opt/basecodecs/_PDCLIB_ascii.c
Pointer typedef resulted in non-const structure where const was intended.
[pdclib] / opt / basecodecs / _PDCLIB_ascii.c
index e84563f747a68b7a50ed8b3a3dfc63f6e3322dcc..1432153f7f2ce26de8a36228fde4ed5a1669faad 100644 (file)
@@ -9,12 +9,15 @@
 #include <uchar.h>
 #include <_PDCLIB_encoding.h>
 
+static bool ascii_mbsinit( const mbstate_t *ps )
+{ return 1; }
+
 static bool asciitoc32(
-    char32_t       **restrict   p_outbuf,
-    size_t          *restrict   p_outsz,
-    const char     **restrict   p_inbuf,
-    size_t          *restrict   p_insz,
-    mbstate_t       *restrict   p_ps
+    char32_t       *restrict *restrict   p_outbuf,
+    size_t                   *restrict   p_outsz,
+    const char     *restrict *restrict   p_inbuf,
+    size_t                   *restrict   p_insz,
+    mbstate_t                *restrict   p_ps
 )
 {
     while(*p_outsz && *p_insz) {
@@ -35,11 +38,11 @@ static bool asciitoc32(
 }
 
 static bool c32toascii(
-    char           **restrict  p_outbuf,
-    size_t          *restrict  p_outsz,
-    const char32_t **restrict  p_inbuf,
-    size_t          *restrict  p_insz,
-    mbstate_t       *restrict  p_ps
+    char           *restrict *restrict  p_outbuf,
+    size_t                   *restrict  p_outsz,
+    const char32_t *restrict *restrict  p_inbuf,
+    size_t                   *restrict  p_insz,
+    mbstate_t                *restrict  p_ps
 )
 {
     while(*p_outsz && *p_insz) {
@@ -59,9 +62,11 @@ static bool c32toascii(
     return true;
 }
 
-_PDCLIB_charcodec_t _PDCLIB_ascii_codec = {
+const struct _PDCLIB_charcodec_t _PDCLIB_ascii_codec = {
+    .__mbsinit   = ascii_mbsinit,
     .__mbstoc32s = asciitoc32,
     .__c32stombs = c32toascii,
+    .__mb_max    = 1,
 };
 
 #endif