if (w > max_width || wctomb (0, wc) > destlen)
if (w > max_width || (k = wctomb (scratch, wc)) > destlen)
void mutt_format_string (char *dest, size_t destlen,			 int min_width, int max_width,			 int right_justify, char pad_char,			 const char *s, size_t n){  char *p;  wchar_t wc;  int w, k;  --destlen;  p = dest;  while ((k = mbtowc (&wc, s, n)))  {    if (k == -1 && n > 0)    {      k = 1;      wc = replacement_char ();    }    s += k, n -= k;    w = wc < M_TREE_MAX ? 1 : wcwidth (wc); /* hack */    if (w >= 0)    {      if (w > max_width || wctomb (0, wc) > destlen)	break;      min_width -= w;      max_width -= w;      p += (k = wctomb (p, wc));      destlen -= k;    }  }  k = (int)destlen < min_width ? destlen : min_width;  if (k <= 0)    *p = '\0';  else if (right_justify)  {    p[k] = '\0';    while (--p >= dest)      p[k] = *p;    while (--k >= 0)      dest[k] = pad_char;  }  else  {    while (--k >= 0)      *p++ = pad_char;    *p = '\0';  }}