X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=curs_lib.c;h=451a6b1d8dce7db126d4778e3904142f3930b383;hp=80c81dd6888f1a533252e70f3f2bb3e5d4ce97bd;hb=4761fa78a6dfc9437caa6e6e0aac806e50e01c83;hpb=7f7a0be369840b290248e5b0302beb447fa1b3cd diff --git a/curs_lib.c b/curs_lib.c index 80c81dd..451a6b1 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "mutt.h" #include "enter.h" @@ -209,7 +210,7 @@ int mutt_yesorno (const char *msg, int def) printw ("%.*s%s", COLS - answer_string_len, msg, answer_string); p_delete(&answer_string); - FOREVER { + for (;;) { mutt_refresh (); ch = mutt_getch (); if (CI_is_return (ch.ch)) @@ -298,7 +299,6 @@ void mutt_curses_error (const char *fmt, ...) set_option (OPTMSGERR); } -#ifdef USE_SOCKET void mutt_progress_bar (progress_t* progress, long pos) { char posstr[SHORT_STRING]; @@ -326,7 +326,6 @@ void mutt_progress_bar (progress_t* progress, long pos) { mutt_message ("%s %s", progress->msg, posstr); } } -#endif void mutt_curses_message (const char *fmt, ...) { @@ -420,7 +419,7 @@ int mutt_do_pager (const char *banner, { int rc; - if (!Pager || str_cmp (Pager, "builtin") == 0) + if (!Pager || m_strcmp(Pager, "builtin") == 0) rc = mutt_pager (banner, tempfile, do_color, info); else { char cmd[STRING]; @@ -530,7 +529,7 @@ int mutt_multi_choice (char *prompt, char *letters) mvaddstr (LINES - 1, 0, prompt); clrtoeol (); - FOREVER { + for (;;) { mutt_refresh (); ch = mutt_getch (); if (ch.ch == -1 || CI_is_return (ch.ch)) { @@ -566,7 +565,7 @@ int mutt_addwch (wchar_t wc) mbstate_t mbstate; size_t n1, n2; - memset (&mbstate, 0, sizeof (mbstate)); + p_clear(&mbstate, 1); if ((n1 = wcrtomb (buf, wc, &mbstate)) == (size_t) (-1) || (n2 = wcrtomb (buf + n1, 0, &mbstate)) == (size_t) (-1)) return -1; /* ERR */ @@ -583,7 +582,7 @@ int mutt_addwch (wchar_t wc) */ void mutt_format_string (char *dest, size_t destlen, - int min_width, int max_width, + unsigned int min_width, int max_width, int right_justify, char m_pad_char, const char *s, size_t n, int arboreal) { @@ -594,8 +593,8 @@ void mutt_format_string (char *dest, size_t destlen, char scratch[MB_LEN_MAX]; mbstate_t mbstate1, mbstate2; - memset (&mbstate1, 0, sizeof (mbstate1)); - memset (&mbstate2, 0, sizeof (mbstate2)); + p_clear(&mbstate1, 1); + p_clear(&mbstate2, 1); --destlen; p = dest; for (; n && (k = mbrtowc (&wc, s, n, &mbstate1)); s += k, n -= k) { @@ -620,7 +619,7 @@ void mutt_format_string (char *dest, size_t destlen, destlen -= k2; } } - w = (int) destlen < min_width ? destlen : min_width; + w = destlen < min_width ? destlen : min_width; if (w <= 0) *p = '\0'; else if (right_justify) { @@ -693,7 +692,7 @@ void mutt_paddstr (int n, const char *s) size_t len = m_strlen(s); mbstate_t mbstate; - memset (&mbstate, 0, sizeof (mbstate)); + p_clear(&mbstate, 1); for (; len && (k = mbrtowc (&wc, s, len, &mbstate)); s += k, len -= k) { if (k == (size_t) (-1) || k == (size_t) (-2)) { k = (k == (size_t) (-1)) ? 1 : len; @@ -730,7 +729,7 @@ int mutt_strwidth (const char *s) n = m_strlen(s); - memset (&mbstate, 0, sizeof (mbstate)); + p_clear(&mbstate, 1); for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) { if (k == (size_t) (-1) || k == (size_t) (-2)) { k = (k == (size_t) (-1)) ? 1 : n;