- // we need to know the representation of L'\0' for this conversion
- size_t nulLen;
- const char * const nul = GetMBNul(&nulLen);
- if ( nulLen == (size_t)-1 || nulLen == 0 )
- return wxWCharBuffer();
+ if ( !srcEnd )
+ {
+ // we convert the entire string in this cas, as we suppose that the
+ // string is NUL-terminated and so srcEnd is not used at all
+ break;
+ }
+
+ // advance the input pointer past the end of this chunk
+ while ( NotAllNULs(src, nulLen) )
+ {
+ // notice that we must skip over multiple bytes here as we suppose
+ // that if NUL takes 2 or 4 bytes, then all the other characters do
+ // too and so if advanced by a single byte we might erroneously
+ // detect sequences of NUL bytes in the middle of the input
+ src += nulLen;
+ }
+
+ src += nulLen; // skipping over its terminator as well
+
+ // note that ">=" (and not just "==") is needed here as the terminator
+ // we skipped just above could be inside or just after the buffer
+ // delimited by inEnd
+ if ( src >= srcEnd )
+ break;
+ }
+
+ return dstWritten;
+}
+
+size_t
+wxMBConv::FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen) const
+{
+ // the number of chars [which would be] written to dst [if it were not NULL]
+ size_t dstWritten = 0;