if (res == NULL)
return NULL;
- // Keep a tail pointer to append to, appending with STRCAT would make
- // this loop quadratic.
char_u *d = res;
p = s;
c = (*mb_ptr2char)(p);
if (vim_isprintc(c))
{
- // append printable multi-byte char
mch_memmove(d, p, (size_t)l);
d += l;
}
else
{
char_u *trs = transchar_byte(*p++);
- int trs_len = (int)STRLEN(trs);
+ size_t trs_len = STRLEN(trs);
- mch_memmove(d, trs, (size_t)trs_len);
+ mch_memmove(d, trs, trs_len);
d += trs_len;
}
}
call assert_equal('^A^_^?', strtrans("\x01\x1f\x7f"))
" an unprintable byte above 0x7f uses the meta notation
call assert_equal('| ', strtrans("\xa0"))
- " a printable high byte is unchanged
call assert_equal("\xe9", strtrans("\xe9"))
call assert_equal("x^B\xe9| y", strtrans("x\x02\xe9\xa0y"))
set encoding=utf-8