]> pd.if.org Git - pdclib.old/blobdiff - internals/_PDCLIB_encoding.h
Modify various POSIX platform files so you can build on top of glibc for testing
[pdclib.old] / internals / _PDCLIB_encoding.h
index f4b837fd6f631f948201759f33d7c1749d9eee4e..fdaee7ee42061044cdb792212b3ef5b4a24287c1 100644 (file)
@@ -75,12 +75,12 @@ 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;
         }
     }
@@ -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)(