]> granicus.if.org Git - neomutt/commit
Clean up mutt_wstr_trunc() some more.
authorKevin McCarthy <kevin@8t8.us>
Wed, 23 Mar 2016 01:00:13 +0000 (18:00 -0700)
committerKevin McCarthy <kevin@8t8.us>
Wed, 23 Mar 2016 01:00:13 +0000 (18:00 -0700)
commita71255f53e10f32c590bb8bee576faf12f782f88
tree2621c028aed1de97a1318be6f5cfd91950526018
parent337b98bab2b8bbb705ae1083b4009a99b91ce5a4
Clean up mutt_wstr_trunc() some more.

* Change return type to size_t.
  The return value is the cumulation of values from mbrtowc(), which
  returns size_t.  All callers already assign the return value to a
  size_t, requiring no external changes.

* Change the local variables n, w, l, and cl to size_t.
  n is the strlen of the src parameter.  l and cl are used for the
  return value.  w is assigned to the *width parameter, which is
  size_t.

  cw is kept as an int, because wcwidth returns type int.

* Change error handling of mbrtowc to be the same as other functions
  in mutt: only reset mbstate when the retval==-1.  When retvat==-2,
  set cl=n to break out of the loop.  Also, set wc to replacement_char
  and allow the logic below to determine the width instead of
  hardcoding to 1.
curs_lib.c
protos.h