for (i = 0; i < len; ++i)
{
if (buf <= end)
+ {
*buf = (unsigned char)(*sw++);
+ /* Although (wchar_t)[*sw] may be nonzero the resulting (unsigned char)
+ * becomes string terminator - we must terminate at that point
+ * to return the correct (unsigned char)-based string end pointer 'buf'.
+ */
+ if (!*buf)
+ break;
+ }
++buf;
}
while (len < field_width--)