-#else
- {
- // Copy the char scratch to the wide output. This requires
- // conversion, but we can optimise by making use of the fact
- // that we are formatting numbers, this should mean only 7-bit
- // ascii characters are involved.
- wchar_t *bufptr = buf;
- const wchar_t *bufend = buf + lenMax;
- const char *scratchptr = szScratch;
-
- // Simply copy each char to a wchar_t, stopping on the first
- // null or non-ascii byte. Checking '(signed char)*scratchptr
- // > 0' is an extra optimisation over '*scratchptr != 0 &&
- // isascii(*scratchptr)', though it assumes signed char is
- // 8-bit 2 complement.
- while ((signed char)*scratchptr > 0 && bufptr != bufend)
- *bufptr++ = *scratchptr++;
-
- if (bufptr == bufend)
- return -1;
-
- lenCur += bufptr - buf;
-
- // check if the loop stopped on a non-ascii char, if yes then
- // fall back to wxMB2WX
- if (*scratchptr)
- {
- size_t len = wxMB2WX(bufptr, scratchptr, bufend - bufptr);
-
- if (len && len != (size_t)(-1))
- if (bufptr[len - 1])
- return -1;
- else
- lenCur += len;
- }
- }
-#endif