begin to move ui code into the lib-ui
[apps/madmutt.git] / lib-ui / curs_lib.c
similarity index 99%
rename from curs_lib.c
rename to lib-ui/curs_lib.c
index 165c4fd..aaaf3ce 100644 (file)
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 
+#include <lib-ui/curses.h>
+
 #include "mutt.h"
 #include "enter.h"
 #include "mutt_menu.h"
 #include "mutt.h"
 #include "enter.h"
 #include "mutt_menu.h"
-#include "mutt_curses.h"
 #include "pager.h"
 #include "mbyte.h"
 
 #include "pager.h"
 #include "mbyte.h"
 
@@ -589,7 +590,7 @@ void mutt_format_string (char *dest, ssize_t destlen,
   char *p;
   wchar_t wc;
   int w;
   char *p;
   wchar_t wc;
   int w;
-  size_t k, k2;
+  ssize_t k, k2;
   char scratch[MB_LEN_MAX];
   mbstate_t mbstate1, mbstate2;
 
   char scratch[MB_LEN_MAX];
   mbstate_t mbstate1, mbstate2;
 
@@ -598,8 +599,8 @@ void mutt_format_string (char *dest, ssize_t destlen,
   --destlen;
   p = dest;
   for (; n && (k = mbrtowc (&wc, s, n, &mbstate1)); s += k, n -= k) {
   --destlen;
   p = dest;
   for (; n && (k = mbrtowc (&wc, s, n, &mbstate1)); s += k, n -= k) {
-    if (k == (size_t) (-1) || k == (size_t) (-2)) {
-      k = (k == (size_t) (-1)) ? 1 : n;
+    if (k == -1 || k == -2) {
+      k = (k == -1) ? 1 : n;
       wc = replacement_char ();
     }
     if (arboreal && wc < M_TREE_MAX)
       wc = replacement_char ();
     }
     if (arboreal && wc < M_TREE_MAX)